Skip to content

Commit

Permalink
Issue #93 - Cleanup old canary replica sets
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Matyushentsev authored and dthomson25 committed Jun 11, 2019
1 parent ae6e277 commit a16fdc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions controller/bluegreen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ func TestBlueGreenHandlePause(t *testing.T) {
f.kubeobjects = append(f.kubeobjects, activeSvc, rs1, rs2)
f.rolloutLister = append(f.rolloutLister, r2)
f.replicaSetLister = append(f.replicaSetLister, rs1, rs2)

f.expectGetServiceAction(activeSvc)
f.serviceLister = append(f.serviceLister, activeSvc)

now := metav1.Now().UTC().Format(time.RFC3339)
expectedPatchWithoutSubs := `{
Expand Down
12 changes: 6 additions & 6 deletions controller/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func (c *Controller) rolloutCanary(rollout *v1alpha1.Rollout, rsList []*appsv1.R
allRSs = append(allRSs, stableRS)
}

logCtx.Info("Cleaning up old replicasets")
if err := c.cleanupRollouts(oldRSs, rollout); err != nil {
return err
}

logCtx.Info("Reconciling StableRS")
scaledStableRS, err := c.reconcileStableRS(oldRSs, newRS, stableRS, rollout)
if err != nil {
Expand Down Expand Up @@ -83,12 +88,7 @@ func (c *Controller) rolloutCanary(rollout *v1alpha1.Rollout, rsList []*appsv1.R
logCtx.Infof("Not finished reconciling Canary Pause")
return c.syncRolloutStatusCanary(oldRSs, newRS, stableRS, rollout)
}
if conditions.RolloutComplete(rollout, &rollout.Status) {
logCtx.Info("Cleaning up old replicasets")
if err := c.cleanupRollouts(oldRSs, rollout); err != nil {
return err
}
}

return c.syncRolloutStatusCanary(oldRSs, newRS, stableRS, rollout)
}

Expand Down

0 comments on commit a16fdc2

Please sign in to comment.