Remove racy check in waitForDeploymentStatus; wait for underlying resources to reach the desired state instead

This commit is contained in:
Janet Kuo 2016-02-22 14:44:28 -08:00
parent 1e680c9d94
commit d2c9d51999

View File

@ -2133,19 +2133,11 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
return false, fmt.Errorf("total pods available: %d, less than the min required: %d", totalAvailable, minAvailable) return false, fmt.Errorf("total pods available: %d, less than the min required: %d", totalAvailable, minAvailable)
} }
// When the deployment status and its underlying resources reach the desired state, we're done
if deployment.Status.Replicas == desiredUpdatedReplicas && if deployment.Status.Replicas == desiredUpdatedReplicas &&
deployment.Status.UpdatedReplicas == desiredUpdatedReplicas { deployment.Status.UpdatedReplicas == desiredUpdatedReplicas &&
// Verify replica sets. deploymentutil.GetReplicaCountForReplicaSets(oldRSs) == 0 &&
if deploymentutil.GetReplicaCountForReplicaSets(oldRSs) != 0 { deploymentutil.GetReplicaCountForReplicaSets([]*extensions.ReplicaSet{newRS}) == desiredUpdatedReplicas {
logReplicaSetsOfDeployment(deploymentName, oldRSs, newRS)
logPodsOfReplicaSets(c, allRSs, minReadySeconds)
return false, fmt.Errorf("old replica sets are not fully scaled down")
}
if deploymentutil.GetReplicaCountForReplicaSets([]*extensions.ReplicaSet{newRS}) != desiredUpdatedReplicas {
logReplicaSetsOfDeployment(deploymentName, oldRSs, newRS)
logPodsOfReplicaSets(c, allRSs, minReadySeconds)
return false, fmt.Errorf("new replica sets is not fully scaled up")
}
return true, nil return true, nil
} }
return false, nil return false, nil