Skip to content

Commit

Permalink
add separate condition for OnDelete strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
mandar242 committed Feb 3, 2023
1 parent 0be00ef commit 26de935
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/module_utils/k8s/waiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,19 @@ def daemonset_ready(daemonset: ResourceInstance) -> bool:


def statefulset_ready(statefulset: ResourceInstance) -> bool:
if statefulset.spec.updateStrategy.type == "OnDelete":
return bool(
statefulset.status
and statefulset.status.observedGeneration
== (statefulset.metadata.generation or 0)
and statefulset.status.replicas == statefulset.spec.replicas
)
# These may be None
updated_replicas = statefulset.status.updatedReplicas or 0
ready_replicas = statefulset.status.readyReplicas or 0
return bool(
statefulset.status
and statefulset.spec.updateStrategy.type in ["RollingUpdate", "OnDelete"]
and statefulset.spec.updateStrategy.type == "RollingUpdate"
and statefulset.status.observedGeneration
== (statefulset.metadata.generation or 0)
and statefulset.status.updateRevision == statefulset.status.currentRevision
Expand Down

0 comments on commit 26de935

Please sign in to comment.