Skip to content

Commit

Permalink
fix: abort scaledowns stable RS for canary with traffic routing
Browse files Browse the repository at this point in the history
- Don't set desiredNewReplica to 0 if rollout is aborted

Signed-off-by: Hui Kang <hui.kang@salesforce.com>
  • Loading branch information
Hui Kang committed Jul 9, 2021
1 parent ba21c6c commit aff0e67
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions test/e2e/istio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,30 @@ func (s *IstioSuite) TestIstioSubsetSplitSingleRoute() {
}).
ExpectRevisionPodCount("1", 1) // don't scale down old replicaset since it will be within scaleDownDelay
}

func (s *IstioSuite) TestIstioAbortUpdate() {
s.Given().
RolloutObjects("@istio/istio-host-split.yaml").
When().
ApplyManifests().
WaitForRolloutStatus("Healthy").
Then().
When().
AbortRollout().
WaitForRolloutStatus("Degraded").
Then().
ExpectRevisionPodCount("1", 1).
When().
UpdateSpec().
WaitForRolloutStatus("Paused").
Then().
When().
PromoteRollout().
WaitForRolloutStatus("Healthy").
Then().
When().
AbortRollout().
WaitForRolloutStatus("Degraded").
Then().
ExpectRevisionPodCount("2", 1)
}
2 changes: 1 addition & 1 deletion utils/replicaset/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func CalculateReplicaCountsForCanary(rollout *v1alpha1.Rollout, newRS *appsv1.Re
desiredStableRSReplicaCount := int32(math.Ceil(float64(rolloutSpecReplica) * (1 - (float64(weight) / 100))))
desiredNewRSReplicaCount := int32(math.Ceil(float64(rolloutSpecReplica) * (float64(weight) / 100)))

if rollout.Spec.Strategy.Canary.TrafficRouting != nil {
if rollout.Spec.Strategy.Canary.TrafficRouting != nil && !rollout.Status.Abort {
return desiredNewRSReplicaCount, rolloutSpecReplica
}

Expand Down

0 comments on commit aff0e67

Please sign in to comment.