-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
k8s_scale - handle scaling StatefulSets with 'updateStrategy=OnDelete' #579
k8s_scale - handle scaling StatefulSets with 'updateStrategy=OnDelete' #579
Conversation
plugins/module_utils/k8s/waiter.py
Outdated
@@ -66,7 +66,7 @@ def statefulset_ready(statefulset: ResourceInstance) -> bool: | |||
ready_replicas = statefulset.status.readyReplicas or 0 | |||
return bool( | |||
statefulset.status | |||
and statefulset.spec.updateStrategy.type == "RollingUpdate" | |||
and statefulset.spec.updateStrategy.type in ["RollingUpdate", "OnDelete"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a bit tricky. The problem with StatefulSets that use OnDelete is that the currentRevision and updateRevision may not match, since pods aren't replaced until they are manually deleted. In some cases, updatedReplicas may also not match the spec's replicas. You can see this by creating a StatefulSet using the OnDelete update strategy and more than one replica. Then, in a separate task, modify the container spec. Now, scale it down to 1 replica.
I think what we need here is two sets of conditions, one for RollingUpdate and one for OnDelete. The block for OnDelete should not check the revision or the updated replicas. So something like:
if statefulset.spec.updateStrategy.type == "OnDelete":
return bool(...) # modified condition checks
return bool(...) # current condition checks
0aa3f26
to
26de935
Compare
SUMMARY
Likely Fixes #503
Handle scaling StatefulSets with 'updateStrategy=OnDelete'
ISSUE TYPE
COMPONENT NAME
k8s_scale
ADDITIONAL INFORMATION