-
Notifications
You must be signed in to change notification settings - Fork 880
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
fix: unavailable stable RS was not scaled down to make room for canary #739
fix: unavailable stable RS was not scaled down to make room for canary #739
Conversation
Codecov Report
@@ Coverage Diff @@
## master #739 +/- ##
=======================================
Coverage 82.57% 82.57%
=======================================
Files 95 95
Lines 8012 8013 +1
=======================================
+ Hits 6616 6617 +1
Misses 994 994
Partials 402 402
Continue to review full report at Codecov.
|
85aa246
to
8142d2a
Compare
@@ -160,23 +160,23 @@ func CalculateReplicaCountsForCanary(rollout *v1alpha1.Rollout, newRS *appsv1.Re | |||
} | |||
} | |||
|
|||
minAvailableReplicaCount := rolloutSpecReplica - MaxUnavailable(rollout) | |||
if GetReplicaCountForReplicaSets(oldRSs) > 0 { |
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.
Note this was changed from GetAvailableReplicaCountForReplicaSets
to GetReplicaCountForReplicaSets
to avoid the same problem with older RSs.
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.
Also to simplify logic, i move the check to return early if there are older RSs up here, so all the logic below only has to deal with new and stable RS, and not have to factor in number of older RSs.
|
||
if newRS != nil && *newRS.Spec.Replicas > desiredNewRSReplicaCount && scaleDownCount > 0 { | ||
if newRS != nil && *newRS.Spec.Replicas > desiredNewRSReplicaCount { |
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.
&& scaleDownCount > 0
check is/was unnecessary because replicasToScaleDown <= minAvailableReplicaCount
covers that.
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.
I can't really comment on the e2e tests, but the actual code change LGMT.
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.
LGTM
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.
What @danny-stytch said.
This is an alternative fix for the issue described in #735
Scenario:
The correct behavior should be that the Rollout scales down one stableRS pod, in order to make room for another canary
The fix is that when calculating the replica counts when scaling down the stableRS, it should consider the Spec.Replicas when it is higher than Status.AvailableReplicas.
This also adds many e2e tests to verify scaling behavior