Skip to content

Commit

Permalink
Re-apply stable to simple canary service on abort when no traffic rou…
Browse files Browse the repository at this point in the history
…ting is used

fixes #2781

Signed-off-by: mitchell amihod <[email protected]>
  • Loading branch information
meeech committed Jun 6, 2023
1 parent b4f5bd0 commit 45bb421
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rollout/canary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1236,8 +1236,14 @@ func TestCanarySVCSelectors(t *testing.T) {
},
},
}

pc := pauseContext{
rollout: rollout,
}

rc := rolloutContext{
log: logutil.WithRollout(rollout),
log: logutil.WithRollout(rollout),
pauseContext: &pc,
reconcilerBase: reconcilerBase{
servicesLister: servicesLister,
kubeclientset: kubeclient,
Expand Down Expand Up @@ -1266,6 +1272,7 @@ func TestCanarySVCSelectors(t *testing.T) {
},
},
}

stopchan := make(chan struct{})
defer close(stopchan)
informers.Start(stopchan)
Expand Down
9 changes: 9 additions & 0 deletions rollout/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,15 @@ func (c *rolloutContext) reconcileStableAndCanaryService() error {
if err != nil {
return err
}

if c.pauseContext != nil && c.pauseContext.IsAborted() && c.rollout.Spec.Strategy.Canary.TrafficRouting == nil {
err = c.ensureSVCTargets(c.rollout.Spec.Strategy.Canary.CanaryService, c.stableRS, true)
if err != nil {
return err
}
return nil
}

err = c.ensureSVCTargets(c.rollout.Spec.Strategy.Canary.CanaryService, c.newRS, true)
if err != nil {
return err
Expand Down

0 comments on commit 45bb421

Please sign in to comment.