Commit b20beaa9 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #49724 from sjenning/skip-sync-mount-terminated-pods

Automatic merge from submit-queue (batch tested with PRs 49284, 49555, 47639, 49526, 49724) skip WaitForAttachAndMount for terminated pods in syncPod Fixes https://github.com/kubernetes/kubernetes/issues/49663 I tried to tread lightly with a small localized change because this needs to be picked to 1.7 and 1.6 as well. I suspect this has been as issue since we started unmounting volumes on pod termination https://github.com/kubernetes/kubernetes/pull/37228 xref openshift/origin#14383 @derekwaynecarr @eparis @smarterclayton @saad-ali @jwforres /release-note-none
parents 67485431 265db191
......@@ -1543,11 +1543,14 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
return err
}
// Wait for volumes to attach/mount
if err := kl.volumeManager.WaitForAttachAndMount(pod); err != nil {
kl.recorder.Eventf(pod, v1.EventTypeWarning, events.FailedMountVolume, "Unable to mount volumes for pod %q: %v", format.Pod(pod), err)
glog.Errorf("Unable to mount volumes for pod %q: %v; skipping pod", format.Pod(pod), err)
return err
// Volume manager will not mount volumes for terminated pods
if !kl.podIsTerminated(pod) {
// Wait for volumes to attach/mount
if err := kl.volumeManager.WaitForAttachAndMount(pod); err != nil {
kl.recorder.Eventf(pod, v1.EventTypeWarning, events.FailedMountVolume, "Unable to mount volumes for pod %q: %v", format.Pod(pod), err)
glog.Errorf("Unable to mount volumes for pod %q: %v; skipping pod", format.Pod(pod), err)
return err
}
}
// Fetch the pull secrets for the pod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment