mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
Nil Check
This commit is contained in:
parent
038f871c43
commit
4a7b4f2ed2
@ -970,7 +970,7 @@ func makeMounts(pod *api.Pod, podDir string, container *api.Container, podVolume
|
|||||||
// - container is not a infrastructure(pause) container
|
// - container is not a infrastructure(pause) container
|
||||||
// - container is not already mounting on /etc/hosts
|
// - container is not already mounting on /etc/hosts
|
||||||
// When the pause container is being created, its IP is still unknown. Hence, PodIP will not have been set.
|
// When the pause container is being created, its IP is still unknown. Hence, PodIP will not have been set.
|
||||||
mountEtcHostsFile := !pod.Spec.SecurityContext.HostNetwork && len(pod.Status.PodIP) > 0
|
mountEtcHostsFile := (pod.Spec.SecurityContext == nil || !pod.Spec.SecurityContext.HostNetwork) && len(pod.Status.PodIP) > 0
|
||||||
glog.V(4).Infof("Will create hosts mount for container:%q, podIP:%s: %v", container.Name, pod.Status.PodIP, mountEtcHostsFile)
|
glog.V(4).Infof("Will create hosts mount for container:%q, podIP:%s: %v", container.Name, pod.Status.PodIP, mountEtcHostsFile)
|
||||||
mounts := []kubecontainer.Mount{}
|
mounts := []kubecontainer.Mount{}
|
||||||
for _, mount := range container.VolumeMounts {
|
for _, mount := range container.VolumeMounts {
|
||||||
|
Loading…
Reference in New Issue
Block a user