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
pull/6/head
Kubernetes Submit Queue 2017-08-01 01:42:02 -07:00 committed by GitHub
commit b20beaa98a
1 changed files with 8 additions and 5 deletions

View File

@ -1543,11 +1543,14 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
return err return err
} }
// Wait for volumes to attach/mount // Volume manager will not mount volumes for terminated pods
if err := kl.volumeManager.WaitForAttachAndMount(pod); err != nil { if !kl.podIsTerminated(pod) {
kl.recorder.Eventf(pod, v1.EventTypeWarning, events.FailedMountVolume, "Unable to mount volumes for pod %q: %v", format.Pod(pod), err) // Wait for volumes to attach/mount
glog.Errorf("Unable to mount volumes for pod %q: %v; skipping pod", format.Pod(pod), err) if err := kl.volumeManager.WaitForAttachAndMount(pod); err != nil {
return err 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 // Fetch the pull secrets for the pod