Skip to content

Commit

Permalink
fix(controller): fix waiting for stable rs to be fully scaled before …
Browse files Browse the repository at this point in the history
…canary scale down

Signed-off-by: Youssef Rabie <[email protected]>
  • Loading branch information
y-rabie authored and zachaller committed Dec 4, 2024
1 parent 7c06316 commit 42cec92
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rollout/replicaset.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ func (c *rolloutContext) reconcileNewReplicaSet() (bool, error) {
}
} else if abortScaleDownDelaySeconds != nil {
// Don't annotate until need to ensure the stable RS is fully scaled
if c.stableRS.Status.AvailableReplicas == *c.rollout.Spec.Replicas {

// We only perform this check if we had something to do with scaling down the stable RS.
// That is, when dynamicStableScale is used. Otherwise, we shouldn't wait for
// it to be the case. Since external influences (cluster autoscalers with their disruptions)
// may prevent the stable rs of becoming fully available for a while, irrelevant to us.

usesDynamicStableScaling := c.rollout.Spec.Strategy.Canary != nil && c.rollout.Spec.Strategy.Canary.DynamicStableScale
if c.stableRS.Status.AvailableReplicas == *c.rollout.Spec.Replicas || !usesDynamicStableScaling {
err = c.addScaleDownDelay(c.newRS, *abortScaleDownDelaySeconds)
if err != nil {
return false, err
Expand Down

0 comments on commit 42cec92

Please sign in to comment.