controllers: set Complete condition on terminal RollingUpgrade states#556
Open
SAY-5 wants to merge 2 commits into
Open
controllers: set Complete condition on terminal RollingUpgrade states#556SAY-5 wants to merge 2 commits into
SAY-5 wants to merge 2 commits into
Conversation
df14921 to
5ae0076
Compare
The controller writes .status.currentStatus on completion and failure but never touches .status.conditions, so `kubectl wait rollingupgrade/x --for condition=complete` never observes a transition and times out even though the resource has already reached a terminal state (keikoproj#321). The behaviour regressed somewhere between 0.13 and 1.0.4. Set a RollingUpgradeCondition of Type UpgradeComplete alongside the existing SetCurrentStatus calls: * ConditionTrue when the scaling group is no longer drifted, * ConditionFalse on Cloud.Discover / RotateNodes failure. The condition list already exists in the CRD and SetCondition upserts rather than duplicates, so existing callers just start seeing the condition flip through. Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com> Fixes keikoproj#321 Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
3453dc3 to
30acac7
Compare
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.
Description
The controller sets
.status.currentStatuswhen aRollingUpgradereaches a terminal state (success or failure) but never touches.status.conditions. That keepskubectl wait rollingupgrade/x --for condition=Completeblocked until timeout even after the upgrade has already finished. The CRD already declaresConditions []RollingUpgradeConditionandUpgradeCompleteas a type, so the plumbing exists, it's just not being written.The reporter notes the behaviour regressed between 0.13 (conditions were set) and 1.0.4 (conditions are not).
Fixes #321.
Change
controllers/upgrade.go:SetCurrentStatus(StatusComplete), emitStatus.SetCondition({Type: UpgradeComplete, Status: ConditionTrue}).Cloud.Discoverfailure branch, emitStatus.SetCondition({Type: UpgradeComplete, Status: ConditionFalse}).controllers/rollingupgrade_controller.go:RotateNodesfailure branch (line ~227), emit the sameConditionFalsevariant alongside the existingSetCurrentStatus(StatusError).RollingUpgradeStatus.SetConditionalready upserts by type, so re-entry is a no-op.Testing
make testpasses locally..status.conditions[?(@.type==\"Complete\")].statusnow flips to"True"at completion;kubectl wait --for condition=Completereturns immediately."False", so--for condition=Complete=Falsealso works.Checklist
make testlocally and all tests passgit commit -sfor DCO verification