mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-03-26 21:33:02 +00:00
Account for updated pods when waiting on DaemonSet (#102)
* Account for updated pods when waiting on DaemonSet The exising logic that's used to determine when a DaemonSet is ready fails to account for the fact that a RollingUpdate first kills the pod and then creates a new one. Simply checking if the desiredNumberScheduled equals the numberReady will succeed in cases when the old pod takes time to shut down, and would report that the new Deployment is ready despite the fact that the old pod has not been replaced, yet. * Add changelog fragment
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
---
|
||||
minor_changes:
|
||||
- k8s - wait for all pods to update when rolling out daemonset changes (https://github.com/ansible-collections/kubernetes.core/pull/102).
|
||||
@@ -54,6 +54,9 @@
|
||||
vars:
|
||||
k8s_pod_name: wait-ds
|
||||
k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:1
|
||||
k8s_pod_command:
|
||||
- sleep
|
||||
- "600"
|
||||
register: ds
|
||||
|
||||
- name: Check that daemonset wait worked
|
||||
@@ -82,6 +85,9 @@
|
||||
vars:
|
||||
k8s_pod_name: wait-ds
|
||||
k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:2
|
||||
k8s_pod_command:
|
||||
- sleep
|
||||
- "600"
|
||||
register: update_ds_check_mode
|
||||
check_mode: yes
|
||||
|
||||
@@ -112,6 +118,9 @@
|
||||
vars:
|
||||
k8s_pod_name: wait-ds
|
||||
k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:3
|
||||
k8s_pod_command:
|
||||
- sleep
|
||||
- "600"
|
||||
register: ds
|
||||
|
||||
- name: Get updated pods
|
||||
|
||||
@@ -403,6 +403,7 @@ class K8sAnsibleMixin(object):
|
||||
|
||||
def _daemonset_ready(daemonset):
|
||||
return (daemonset.status and daemonset.status.desiredNumberScheduled is not None
|
||||
and daemonset.status.updatedNumberScheduled == daemonset.status.desiredNumberScheduled
|
||||
and daemonset.status.numberReady == daemonset.status.desiredNumberScheduled
|
||||
and daemonset.status.observedGeneration == daemonset.metadata.generation
|
||||
and not daemonset.status.unavailableReplicas)
|
||||
|
||||
Reference in New Issue
Block a user