Quellcode durchsuchen

Merge pull request #9983 from vrutkovs/sync-set-annotations

Annotate nodes with md5sum of the applied config after sync DS has updated configs
OpenShift Merge Robot vor 6 Jahren
Ursprung
Commit
0cced5fa0e

+ 3 - 0
roles/openshift_node_group/files/sync.yaml

@@ -141,6 +141,9 @@ spec:
                 continue
                 continue
               fi
               fi
             fi
             fi
+            # annotate node with md5sum of the config
+            oc annotate --config=/etc/origin/node/node.kubeconfig "node/${NODE_NAME}" \
+              node.openshift.io/md5sum="$( cat /tmp/.new | cut -d' ' -f1 )" --overwrite
             cp -f /tmp/.new /tmp/.old
             cp -f /tmp/.new /tmp/.old
             sleep 180 &
             sleep 180 &
             wait $!
             wait $!

+ 33 - 2
roles/openshift_node_group/tasks/sync.yml

@@ -70,5 +70,36 @@
     - __status_of_sync_ds.results.results[0].status.desiredNumberScheduled is defined
     - __status_of_sync_ds.results.results[0].status.desiredNumberScheduled is defined
     - __status_of_sync_ds.results.results[0].status.numberAvailable == __status_of_sync_ds.results.results[0].status.desiredNumberScheduled
     - __status_of_sync_ds.results.results[0].status.numberAvailable == __status_of_sync_ds.results.results[0].status.desiredNumberScheduled
   retries: 60
   retries: 60
-  delay: 30
-  failed_when: false
+  delay: 10
+
+- name: Wait for sync DS to set annotations on all nodes
+  oc_obj:
+    state: list
+    kind: node
+    selector: ""
+  register: node_status
+  until:
+    - node_status.results is defined
+    - node_status.results.results is defined
+    - node_status.results.results | length > 0
+    - node_status.results.results[0]['items']
+     | map(attribute='metadata.annotations') | map('list') | flatten
+     | select('match', '[\"node.openshift.io/md5sum\"]') | list | length == node_status.results.results | length
+  retries: 60
+  delay: 10
+
+# Sync DS may have restarted masters
+- name: Verify api server is available
+  command: >
+    curl --silent --tlsv1.2
+    --cacert {{ openshift.common.config_base }}/master/ca-bundle.crt
+    {{ openshift.master.api_url }}/healthz/ready
+  args:
+    # Disables the following warning:
+    # Consider using get_url or uri module rather than running curl
+    warn: no
+  register: api_available_output
+  until: api_available_output.stdout == 'ok'
+  retries: 120
+  delay: 1
+  changed_when: false