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.
This commit is contained in:
Euan Kemp 2016-08-15 17:52:57 -07:00 committed by Euan Kemp
parent 804109d349
commit c94e134ae4

View File

@ -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)