mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #17756 from zhengguoyong/check_ref_before_use
Auto commit by PR queue bot
This commit is contained in:
commit
50af1d6550
@ -1646,19 +1646,16 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Starting phase:
|
|
||||||
ref, err := api.GetReference(pod)
|
|
||||||
if err != nil {
|
|
||||||
glog.Errorf("Couldn't make a ref to pod %q: '%v'", podFullName, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mount volumes.
|
// Mount volumes.
|
||||||
podVolumes, err := kl.mountExternalVolumes(pod)
|
podVolumes, err := kl.mountExternalVolumes(pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
ref, errGetRef := api.GetReference(pod)
|
||||||
|
if errGetRef == nil && ref != nil {
|
||||||
kl.recorder.Eventf(ref, api.EventTypeWarning, kubecontainer.FailedMountVolume, "Unable to mount volumes for pod %q: %v", podFullName, err)
|
kl.recorder.Eventf(ref, api.EventTypeWarning, kubecontainer.FailedMountVolume, "Unable to mount volumes for pod %q: %v", podFullName, err)
|
||||||
glog.Errorf("Unable to mount volumes for pod %q: %v; skipping pod", podFullName, err)
|
glog.Errorf("Unable to mount volumes for pod %q: %v; skipping pod", podFullName, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
kl.volumeManager.SetVolumes(pod.UID, podVolumes)
|
kl.volumeManager.SetVolumes(pod.UID, podVolumes)
|
||||||
|
|
||||||
// The kubelet is the source of truth for pod status. It ignores the status sent from
|
// The kubelet is the source of truth for pod status. It ignores the status sent from
|
||||||
|
Loading…
Reference in New Issue
Block a user