Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubelet: reduce extraneous logging for pods using host network #41423

Merged
merged 1 commit into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions pkg/kubelet/dockershim/docker_sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 != "" {
Expand Down
4 changes: 3 additions & 1 deletion pkg/kubelet/kuberuntime/kuberuntime_sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably add a comment here about what an empty stirng means here.

// 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 ""
}
Expand Down