From 2a224b3414ea14496d27cdb507d560c165ad508a Mon Sep 17 00:00:00 2001 From: Yu-Ju Hong Date: Fri, 26 May 2017 12:53:22 -0700 Subject: [PATCH] kubelet: remove a redundant check for mounting the hosts file HostNetwork is not part of the Pod.Spec.SecurityContext in the versioned pod. Remove the redundant check. --- pkg/kubelet/kubelet_pods.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kubelet/kubelet_pods.go b/pkg/kubelet/kubelet_pods.go index 245a8b5bec2..b26449e954f 100644 --- a/pkg/kubelet/kubelet_pods.go +++ b/pkg/kubelet/kubelet_pods.go @@ -114,7 +114,7 @@ func makeMounts(pod *v1.Pod, podDir string, container *v1.Container, hostName, h // - 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. // OS is not Windows - mountEtcHostsFile := (pod.Spec.SecurityContext == nil || !pod.Spec.HostNetwork) && len(podIP) > 0 && runtime.GOOS != "windows" + mountEtcHostsFile := !pod.Spec.HostNetwork && len(podIP) > 0 && runtime.GOOS != "windows" glog.V(3).Infof("container: %v/%v/%v podIP: %q creating hosts mount: %v", pod.Namespace, pod.Name, container.Name, podIP, mountEtcHostsFile) mounts := []kubecontainer.Mount{} for _, mount := range container.VolumeMounts {