Forráskód Böngészése

Merge pull request #5687 from jim-minter/tsb_config

Automatic merge from submit-queue.

Rewire openshift_template_service_broker_namespaces configurable

@ewolinetz 
@bparees
OpenShift Merge Robot 7 éve
szülő
commit
1d75eb325c

+ 7 - 2
inventory/byo/hosts.example

@@ -811,8 +811,13 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
 # Or you may optionally define your own build overrides configuration serialized as json
 #openshift_buildoverrides_json='{"BuildOverrides":{"configuration":{"apiVersion":"v1","kind":"BuildDefaultsConfig","forcePull":"true"}}}'
 
-# Enable template service broker by specifying one of more namespaces whose
-# templates will be served by the broker
+# Enable service catalog
+#openshift_enable_service_catalog=true
+
+# Enable template service broker (requires service catalog to be enabled, above)
+#template_service_broker_install=true
+
+# Configure one of more namespaces whose templates will be served by the TSB
 #openshift_template_service_broker_namespaces=['openshift']
 
 # masterConfig.volumeConfig.dynamicProvisioningEnabled, configurable as of 1.2/3.2, enabled by default

+ 0 - 7
roles/openshift_master/templates/master.yaml.v1.j2

@@ -275,12 +275,5 @@ servingInfo:
   - {{ cipher_suite }}
 {% endfor %}
 {% endif %}
-{% if openshift_template_service_broker_namespaces is defined %}
-templateServiceBrokerConfig:
-  templateNamespaces:
-{% for namespace in openshift_template_service_broker_namespaces %}
-  - {{ namespace }}
-{% endfor %}
-{% endif %}
 volumeConfig:
   dynamicProvisioningEnabled: {{ openshift.master.dynamic_provisioning_enabled }}

+ 1 - 0
roles/template_service_broker/defaults/main.yml

@@ -2,3 +2,4 @@
 # placeholder file?
 template_service_broker_remove: False
 template_service_broker_install: False
+openshift_template_service_broker_namespaces: ['openshift']

+ 15 - 1
roles/template_service_broker/tasks/install.yml

@@ -28,10 +28,24 @@
     - "{{ __tsb_template_file }}"
     - "{{ __tsb_rbac_file }}"
     - "{{ __tsb_broker_file }}"
+    - "{{ __tsb_config_file }}"
+
+- yedit:
+    src: "{{ mktemp.stdout }}/{{ __tsb_config_file }}"
+    key: templateNamespaces
+    value: "{{ openshift_template_service_broker_namespaces }}"
+    value_type: list
+
+- slurp:
+    src: "{{ mktemp.stdout }}/{{ __tsb_config_file }}"
+  register: config
 
 - name: Apply template file
   shell: >
-    oc process -f "{{ mktemp.stdout }}/{{ __tsb_template_file }}" --param API_SERVER_CONFIG="{{ lookup('file', __tsb_files_location ~ '/' ~ __tsb_config_file) }}" --param IMAGE="{{ template_service_broker_prefix }}{{ template_service_broker_image_name }}:{{ template_service_broker_version }}" | kubectl apply -f -
+    oc process -f "{{ mktemp.stdout }}/{{ __tsb_template_file }}"
+    --param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
+    --param IMAGE="{{ template_service_broker_prefix }}{{ template_service_broker_image_name }}:{{ template_service_broker_version }}"
+    | kubectl apply -f -
 
 # reconcile with rbac
 - name: Reconcile with RBAC file