Commit d47ffa08 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #41423 from yujuhong/better_logging

Automatic merge from submit-queue (batch tested with PRs 41360, 41423, 41430, 40647, 41352) kubelet: reduce extraneous logging for pods using host network For pods using the host network, kubelet/shim should not log error/warning messages when determining the pod IP address.
parents 2fde8f8e 77286c38
......@@ -178,9 +178,6 @@ func (ds *dockerService) getIPFromPlugin(sandbox *dockertypes.ContainerJSON) (st
return "", err
}
msg := fmt.Sprintf("Couldn't find network status for %s/%s through plugin", metadata.Namespace, metadata.Name)
if sharesHostNetwork(sandbox) {
return "", fmt.Errorf("%v: not responsible for host-network sandboxes", msg)
}
cID := kubecontainer.BuildContainerID(runtimeName, sandbox.ID)
networkStatus, err := ds.networkPlugin.GetPodNetworkStatus(metadata.Namespace, metadata.Name, cID)
if err != nil {
......@@ -202,6 +199,11 @@ func (ds *dockerService) getIP(sandbox *dockertypes.ContainerJSON) (string, erro
if sandbox.NetworkSettings == nil {
return "", nil
}
if sharesHostNetwork(sandbox) {
// For sandboxes using host network, the shim is not responsible for
// reporting the IP.
return "", nil
}
if IP, err := ds.getIPFromPlugin(sandbox); err != nil {
glog.Warningf("%v", err)
} else if IP != "" {
......
......@@ -198,7 +198,9 @@ func (m *kubeGenericRuntimeManager) determinePodSandboxIP(podNamespace, podName
return ""
}
ip := podSandbox.Network.Ip
if net.ParseIP(ip) == nil {
if len(ip) != 0 && net.ParseIP(ip) == nil {
// ip could be an empty string if runtime is not responsible for the
// IP (e.g., host networking).
glog.Warningf("Pod Sandbox reported an unparseable IP %v", ip)
return ""
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment