Skip to content

Commit 42cec92

Browse files
y-rabiezachaller
authored andcommitted
fix(controller): fix waiting for stable rs to be fully scaled before canary scale down
Signed-off-by: Youssef Rabie <[email protected]>
1 parent 7c06316 commit 42cec92

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

rollout/replicaset.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,14 @@ func (c *rolloutContext) reconcileNewReplicaSet() (bool, error) {
160160
}
161161
} else if abortScaleDownDelaySeconds != nil {
162162
// Don't annotate until need to ensure the stable RS is fully scaled
163-
if c.stableRS.Status.AvailableReplicas == *c.rollout.Spec.Replicas {
163+
164+
// We only perform this check if we had something to do with scaling down the stable RS.
165+
// That is, when dynamicStableScale is used. Otherwise, we shouldn't wait for
166+
// it to be the case. Since external influences (cluster autoscalers with their disruptions)
167+
// may prevent the stable rs of becoming fully available for a while, irrelevant to us.
168+
169+
usesDynamicStableScaling := c.rollout.Spec.Strategy.Canary != nil && c.rollout.Spec.Strategy.Canary.DynamicStableScale
170+
if c.stableRS.Status.AvailableReplicas == *c.rollout.Spec.Replicas || !usesDynamicStableScaling {
164171
err = c.addScaleDownDelay(c.newRS, *abortScaleDownDelaySeconds)
165172
if err != nil {
166173
return false, err

0 commit comments

Comments
 (0)