Merge pull request #34548 from kargakis/estimate-available-from-rs

Automatic merge from submit-queue

controller: set minReadySeconds in deployment's replica sets

* Estimate available pods for a deployment by using minReadySeconds on
the replica set.
* Stop requeueing deployments on pod events, superseded by following the
replica set status.
* Cleanup redundant deployment utilities

Fixes https://github.com/kubernetes/kubernetes/issues/26079

@kubernetes/deployment ptal
This commit is contained in:
Kubernetes Submit Queue
2016-10-17 08:44:51 -07:00
committed by GitHub
8 changed files with 56 additions and 394 deletions

View File

@@ -2880,10 +2880,6 @@ func WaitForDeploymentStatusValid(c clientset.Interface, d *extensions.Deploymen
}
}
totalCreated := deploymentutil.GetReplicaCountForReplicaSets(allRSs)
totalAvailable, err := deploymentutil.GetAvailablePodsForDeployment(c, deployment)
if err != nil {
return false, err
}
maxCreated := deployment.Spec.Replicas + deploymentutil.MaxSurge(*deployment)
if totalCreated > maxCreated {
reason = fmt.Sprintf("total pods created: %d, more than the max allowed: %d", totalCreated, maxCreated)
@@ -2891,8 +2887,8 @@ func WaitForDeploymentStatusValid(c clientset.Interface, d *extensions.Deploymen
return false, nil
}
minAvailable := deploymentutil.MinAvailable(deployment)
if totalAvailable < minAvailable {
reason = fmt.Sprintf("total pods available: %d, less than the min required: %d", totalAvailable, minAvailable)
if deployment.Status.AvailableReplicas < minAvailable {
reason = fmt.Sprintf("total pods available: %d, less than the min required: %d", deployment.Status.AvailableReplicas, minAvailable)
Logf(reason)
return false, nil
}
@@ -2941,10 +2937,6 @@ func WaitForDeploymentStatus(c clientset.Interface, d *extensions.Deployment) er
}
}
totalCreated := deploymentutil.GetReplicaCountForReplicaSets(allRSs)
totalAvailable, err := deploymentutil.GetAvailablePodsForDeployment(c, deployment)
if err != nil {
return false, err
}
maxCreated := deployment.Spec.Replicas + deploymentutil.MaxSurge(*deployment)
if totalCreated > maxCreated {
logReplicaSetsOfDeployment(deployment, allOldRSs, newRS)
@@ -2952,10 +2944,10 @@ func WaitForDeploymentStatus(c clientset.Interface, d *extensions.Deployment) er
return false, fmt.Errorf("total pods created: %d, more than the max allowed: %d", totalCreated, maxCreated)
}
minAvailable := deploymentutil.MinAvailable(deployment)
if totalAvailable < minAvailable {
if deployment.Status.AvailableReplicas < minAvailable {
logReplicaSetsOfDeployment(deployment, allOldRSs, newRS)
logPodsOfDeployment(c, deployment)
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", deployment.Status.AvailableReplicas, minAvailable)
}
// When the deployment status and its underlying resources reach the desired state, we're done