Browse Source

Updating to label node and wait for apiservice to be healthy and started

ewolinetz 7 years ago
parent
commit
0ba0acba90

+ 1 - 1
roles/openshift_service_catalog/defaults/main.yml

@@ -1,3 +1,3 @@
 ---
 openshift_service_catalog_remove: false
-openshift_service_catalog_nodeselector: {}
+openshift_service_catalog_nodeselector: {"openshift-infra": "apiserver"}

+ 4 - 2
roles/openshift_service_catalog/tasks/install.yml

@@ -98,7 +98,7 @@
     cpu_requests: none
     memory_request: none
     cors_allowed_origin: localhost
-    node_selector: {"openshift-infra": "apiserver"}
+    node_selector: "{{ openshift_service_catalog_nodeselector | default ({'openshift-infra': 'apiserver'}) }}"
 
 - name: Set Service Catalog API Server daemonset
   oc_obj:
@@ -146,7 +146,7 @@
     image: ""
     cpu_limit: none
     memory_limit: none
-    node_selector: {"openshift-infra": "apiserver"}
+    node_selector: "{{ openshift_service_catalog_nodeselector | default ({'openshift-infra': 'apiserver'}) }}"
 
 - name: Set Controller Manager deployment
   oc_obj:
@@ -172,6 +172,8 @@
       - "{{ mktemp.stdout }}/controller_manager_service.yml"
     delete_after: yes
 
+- include: start_api_server.yml
+
 - name: Delete temp directory
   file:
     name: "{{ mktemp.stdout }}"

+ 22 - 0
roles/openshift_service_catalog/tasks/start_api_server.yml

@@ -0,0 +1,22 @@
+---
+# Label nodes and wait for apiserver and controller to be running (at least one)
+- name: Label {{ openshift.node.nodename }} for APIServer and controller deployment
+  oc_label:
+    name: "{{ openshift.node.nodename }}"
+    kind: node
+    state: add
+    labels: "{{ openshift_service_catalog_nodeselector | default ({'openshift-infra': 'apiserver'}) | oo_dict_to_list_of_dict }}"
+
+# wait to see that the apiserver is available
+- name: wait for api server to be ready
+  command: >
+    curl -k https://apiserver.kube-service-catalog.svc/healthz
+  args:
+    # Disables the following warning:
+    # Consider using get_url or uri module rather than running curl
+    warn: no
+  register: api_health
+  until: api_health.stdout == 'ok'
+  retries: 120
+  delay: 1
+  changed_when: false