Skip to content

Commit

Permalink
Merge pull request kubernetes#19520 from janetkuo/deployment-expectat…
Browse files Browse the repository at this point in the history
…ion-fix

Fix e2e flake: Fix incorrect expectation when deployment scaling down old rcs
  • Loading branch information
alex-mohr committed Jan 20, 2016
2 parents a5d2c1b + d693ffa commit a905067
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pkg/controller/deployment/deployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl
return false, nil
}
totalScaleDownCount := readyPodCount - minAvailable
totalScaledDown := 0
for _, targetRC := range oldRCs {
if totalScaleDownCount == 0 {
// No further scaling required.
Expand All @@ -649,14 +650,16 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl
if err != nil {
return false, err
}
totalScaledDown += scaleDownCount
totalScaleDownCount -= scaleDownCount
dKey, err := controller.KeyFunc(&deployment)
if err != nil {
return false, fmt.Errorf("Couldn't get key for deployment %#v: %v", deployment, err)
}
if expectationsCheck {
dc.podExpectations.ExpectDeletions(dKey, scaleDownCount)
}
}
// Expect to see old rcs scaled down by exactly totalScaledDownCount (sum of scaleDownCount) replicas.
dKey, err = controller.KeyFunc(&deployment)
if err != nil {
return false, fmt.Errorf("Couldn't get key for deployment %#v: %v", deployment, err)
}
if expectationsCheck {
dc.podExpectations.ExpectDeletions(dKey, totalScaledDown)
}
return true, err
}
Expand Down

0 comments on commit a905067

Please sign in to comment.