From c94e134ae4694558e80948f85f905d4940737b2f Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Mon, 15 Aug 2016 17:52:57 -0700 Subject: [PATCH] dockertools: Don't use network plugin if net=host This was already handled in most places. I think this is the only remaining instance of it in the docker package. This could lead to confusing results. E.g. if `networkPlugin` was cni, it could lead to error logs about not getting network status for host pods if eth0 didn't exist on the host. --- pkg/kubelet/dockertools/docker_manager.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/dockertools/docker_manager.go b/pkg/kubelet/dockertools/docker_manager.go index c55d3e6cc46..0c0c7c0029c 100644 --- a/pkg/kubelet/dockertools/docker_manager.go +++ b/pkg/kubelet/dockertools/docker_manager.go @@ -344,7 +344,11 @@ func (dm *DockerManager) determineContainerIP(podNamespace, podName string, cont } } - if dm.networkPlugin.Name() != network.DefaultPluginName { + networkMode := getDockerNetworkMode(container) + isHostNetwork := networkMode == namespaceModeHost + + // For host networking or default network plugin, GetPodNetworkStatus doesn't work + if !isHostNetwork && dm.networkPlugin.Name() != network.DefaultPluginName { netStatus, err := dm.networkPlugin.GetPodNetworkStatus(podNamespace, podName, kubecontainer.DockerID(container.ID).ContainerID()) if err != nil { glog.Errorf("NetworkPlugin %s failed on the status hook for pod '%s' - %v", dm.networkPlugin.Name(), podName, err)