Merge pull request #35691 from kargakis/controller-changes-for-perma-failed
Automatic merge from submit-queue Controller changes for perma failed deployments This PR adds support for reporting failed deployments based on a timeout parameter defined in the spec. If there is no progress for the amount of time defined as progressDeadlineSeconds then the deployment will be marked as failed by a Progressing condition with a ProgressDeadlineExceeded reason. Follow-up to https://github.com/kubernetes/kubernetes/pull/19343 Docs at kubernetes/kubernetes.github.io#1337 Fixes https://github.com/kubernetes/kubernetes/issues/14519 @kubernetes/deployment @smarterclayton
This commit is contained in:
@@ -3177,6 +3177,23 @@ func WaitForObservedDeployment(c clientset.Interface, ns, deploymentName string,
|
||||
return deploymentutil.WaitForObservedDeployment(func() (*extensions.Deployment, error) { return c.Extensions().Deployments(ns).Get(deploymentName) }, desiredGeneration, Poll, 1*time.Minute)
|
||||
}
|
||||
|
||||
func WaitForDeploymentWithCondition(c clientset.Interface, ns, deploymentName, reason string, condType extensions.DeploymentConditionType) error {
|
||||
var conditions []extensions.DeploymentCondition
|
||||
pollErr := wait.PollImmediate(time.Second, 1*time.Minute, func() (bool, error) {
|
||||
deployment, err := c.Extensions().Deployments(ns).Get(deploymentName)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
conditions = deployment.Status.Conditions
|
||||
cond := deploymentutil.GetDeploymentCondition(deployment.Status, condType)
|
||||
return cond != nil && cond.Reason == reason, nil
|
||||
})
|
||||
if pollErr == wait.ErrWaitTimeout {
|
||||
pollErr = fmt.Errorf("deployment %q never updated with the desired condition and reason: %v", deploymentName, conditions)
|
||||
}
|
||||
return pollErr
|
||||
}
|
||||
|
||||
func logPodsOfDeployment(c clientset.Interface, deployment *extensions.Deployment) {
|
||||
minReadySeconds := deployment.Spec.MinReadySeconds
|
||||
podList, err := deploymentutil.ListPods(deployment,
|
||||
|
Reference in New Issue
Block a user