Fix potential problem when scaling --replicas=0
We have defensive code for checking if newRS != nil for DeploymentProgressing and DeploymentTimedOut but not for DeploymentComplete. Let's add the check here as well as this problem was seen in the wild.
This commit is contained in:
parent
175a6dee47
commit
5690ba6241
@ -52,7 +52,10 @@ func (dc *DeploymentController) syncRolloutStatus(allRSs []*extensions.ReplicaSe
|
||||
case util.DeploymentComplete(d, &newStatus):
|
||||
// Update the deployment conditions with a message for the new replica set that
|
||||
// was successfully deployed. If the condition already exists, we ignore this update.
|
||||
msg := fmt.Sprintf("ReplicaSet %q has successfully progressed.", newRS.Name)
|
||||
msg := fmt.Sprintf("Deployment %q has successfully progressed.", d.Name)
|
||||
if newRS != nil {
|
||||
msg = fmt.Sprintf("ReplicaSet %q has successfully progressed.", newRS.Name)
|
||||
}
|
||||
condition := util.NewDeploymentCondition(extensions.DeploymentProgressing, v1.ConditionTrue, util.NewRSAvailableReason, msg)
|
||||
util.SetDeploymentCondition(&newStatus, *condition)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user