From 15fc470343dfb6d8593f2548fe24ccec5ca27761 Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Wed, 7 Dec 2016 17:23:04 -0800 Subject: [PATCH] kubelet: remove redundant hostNetwork helper It did the same thing as the helper in kubecontainer --- pkg/kubelet/kubelet.go | 4 ++-- pkg/kubelet/kubelet_pods.go | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 680d4f383d5..54f3e37042a 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -1443,7 +1443,7 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error { } // If the network plugin is not ready, only start the pod if it uses the host network - if rs := kl.runtimeState.networkErrors(); len(rs) != 0 && !podUsesHostNetwork(pod) { + if rs := kl.runtimeState.networkErrors(); len(rs) != 0 && !kubecontainer.IsHostNetworkPod(pod) { return fmt.Errorf("network is not ready: %v", rs) } @@ -1548,7 +1548,7 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error { return err } if egress != nil || ingress != nil { - if podUsesHostNetwork(pod) { + if kubecontainer.IsHostNetworkPod(pod) { kl.recorder.Event(pod, v1.EventTypeWarning, events.HostNetworkNotSupported, "Bandwidth shaping is not currently supported on the host network") } else if kl.shaper != nil { if len(apiPodStatus.PodIP) > 0 { diff --git a/pkg/kubelet/kubelet_pods.go b/pkg/kubelet/kubelet_pods.go index 32f3ca3506d..0fe3d1ffba6 100644 --- a/pkg/kubelet/kubelet_pods.go +++ b/pkg/kubelet/kubelet_pods.go @@ -592,11 +592,6 @@ func (kl *Kubelet) makePodDataDirs(pod *v1.Pod) error { return nil } -// returns whether the pod uses the host network namespace. -func podUsesHostNetwork(pod *v1.Pod) bool { - return pod.Spec.HostNetwork -} - // getPullSecretsForPod inspects the Pod and retrieves the referenced pull // secrets. // TODO: duplicate secrets are being retrieved multiple times and there @@ -1066,7 +1061,7 @@ func (kl *Kubelet) generateAPIPodStatus(pod *v1.Pod, podStatus *kubecontainer.Po glog.V(4).Infof("Cannot get host IP: %v", err) } else { s.HostIP = hostIP.String() - if podUsesHostNetwork(pod) && s.PodIP == "" { + if kubecontainer.IsHostNetworkPod(pod) && s.PodIP == "" { s.PodIP = hostIP.String() } }