Merge pull request #84123 from smarterclayton/terminating_cause

Handle namespace deletion more gracefully in built-in controllers
This commit is contained in:
Kubernetes Prow Robot
2019-11-04 07:55:41 -08:00
committed by GitHub
17 changed files with 131 additions and 33 deletions

View File

@@ -578,7 +578,10 @@ func (r RealPodControl) createPods(nodeName, namespace string, template *v1.PodT
}
newPod, err := r.KubeClient.CoreV1().Pods(namespace).Create(pod)
if err != nil {
r.Recorder.Eventf(object, v1.EventTypeWarning, FailedCreatePodReason, "Error creating: %v", err)
// only send an event if the namespace isn't terminating
if !apierrors.HasStatusCause(err, v1.NamespaceTerminatingCause) {
r.Recorder.Eventf(object, v1.EventTypeWarning, FailedCreatePodReason, "Error creating: %v", err)
}
return err
}
accessor, err := meta.Accessor(object)