Skip to content

Commit c6d7ff0

Browse files
authored
fix: abort scaledown stable RS for canary with traffic routing (argoproj#1331)
Signed-off-by: Hui Kang <[email protected]>
1 parent e6bae87 commit c6d7ff0

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

test/e2e/istio_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,30 @@ func (s *IstioSuite) TestIstioSubsetSplitSingleRoute() {
197197
}).
198198
ExpectRevisionPodCount("1", 1) // don't scale down old replicaset since it will be within scaleDownDelay
199199
}
200+
201+
func (s *IstioSuite) TestIstioAbortUpdate() {
202+
s.Given().
203+
RolloutObjects("@istio/istio-host-split.yaml").
204+
When().
205+
ApplyManifests().
206+
WaitForRolloutStatus("Healthy").
207+
Then().
208+
When().
209+
AbortRollout().
210+
WaitForRolloutStatus("Degraded").
211+
Then().
212+
ExpectRevisionPodCount("1", 1).
213+
When().
214+
UpdateSpec().
215+
WaitForRolloutStatus("Paused").
216+
Then().
217+
When().
218+
PromoteRollout().
219+
WaitForRolloutStatus("Healthy").
220+
Then().
221+
When().
222+
AbortRollout().
223+
WaitForRolloutStatus("Degraded").
224+
Then().
225+
ExpectRevisionPodCount("2", 1)
226+
}

utils/replicaset/canary.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func GetCurrentCanaryStep(rollout *v1alpha1.Rollout) (*v1alpha1.CanaryStep, *int
293293

294294
// GetCanaryReplicasOrWeight either returns a static set of replicas or a weight percentage
295295
func GetCanaryReplicasOrWeight(rollout *v1alpha1.Rollout) (*int32, int32) {
296-
if rollout.Status.PromoteFull {
296+
if rollout.Status.PromoteFull || rollout.Status.CurrentPodHash == rollout.Status.StableRS {
297297
return nil, 100
298298
}
299299
if scs := UseSetCanaryScale(rollout); scs != nil {

0 commit comments

Comments
 (0)