fix(statefulset): don't skip Delete when scale-to-0 Update fails#1993
Merged
sunsingerus merged 1 commit intoMay 29, 2026
Merged
Conversation
doDeleteStatefulSet returned early when the courtesy scale-to-0 Update failed (e.g. 409 Conflict from concurrent kube-controller-manager writes to .status), never reaching the actual Delete. recreateStatefulSet then silently discarded the error and called createStatefulSet, which observed the still-existing STS and failed with AlreadyExists. The operator finalised the reconcile as Completed while the host stayed at Replicas=0 with no further self-correction. doDeleteStatefulSet: - Treat scale-to-0 as best-effort. On Update failure, log a warning and proceed to Delete which terminates pods anyway. - Treat IsNotFound on Get as success (contract: STS is gone). - Skip scale-down when Replicas is already 0. - Propagate Delete errors instead of swallowing them. recreateStatefulSet: - Stop discarding the error from doDeleteStatefulSet. Return a plain error so the next reconcile retries; ErrCRUDAbort would mark the whole CHI as ReconcileAbort and require manual intervention, which is too aggressive for a transient conflict. Signed-off-by: dashashutosh80 <dashashutosh80@gmail.com>
sunsingerus
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
doDeleteStatefulSet returned early when the courtesy scale-to-0 Update failed (e.g. 409 Conflict from concurrent kube-controller-manager writes to .status), never reaching the actual Delete. recreateStatefulSet then silently discarded the error and called createStatefulSet, which observed the still-existing STS and failed with AlreadyExists. The operator finalised the reconcile as Completed while the host stayed at Replicas=0 with no further self-correction.
doDeleteStatefulSet:
recreateStatefulSet:
Important items to consider before making a Pull Request
Please check items PR complies to:
next-releasebranch, not intomasterbranch1. More infoThis issue fixes #1990