mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Fix incorrect expectation when deployment scaling down old rcs
This commit is contained in:
parent
9d23d75071
commit
d693ffaa57
@ -631,6 +631,7 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
totalScaleDownCount := readyPodCount - minAvailable
|
totalScaleDownCount := readyPodCount - minAvailable
|
||||||
|
totalScaledDown := 0
|
||||||
for _, targetRC := range oldRCs {
|
for _, targetRC := range oldRCs {
|
||||||
if totalScaleDownCount == 0 {
|
if totalScaleDownCount == 0 {
|
||||||
// No further scaling required.
|
// No further scaling required.
|
||||||
@ -647,14 +648,16 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
totalScaledDown += scaleDownCount
|
||||||
totalScaleDownCount -= scaleDownCount
|
totalScaleDownCount -= scaleDownCount
|
||||||
dKey, err := controller.KeyFunc(&deployment)
|
}
|
||||||
if err != nil {
|
// Expect to see old rcs scaled down by exactly totalScaledDownCount (sum of scaleDownCount) replicas.
|
||||||
return false, fmt.Errorf("Couldn't get key for deployment %#v: %v", deployment, err)
|
dKey, err = controller.KeyFunc(&deployment)
|
||||||
}
|
if err != nil {
|
||||||
if expectationsCheck {
|
return false, fmt.Errorf("Couldn't get key for deployment %#v: %v", deployment, err)
|
||||||
dc.podExpectations.ExpectDeletions(dKey, scaleDownCount)
|
}
|
||||||
}
|
if expectationsCheck {
|
||||||
|
dc.podExpectations.ExpectDeletions(dKey, totalScaledDown)
|
||||||
}
|
}
|
||||||
return true, err
|
return true, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user