mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
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.
This commit is contained in:
commit
d47ffa08c7
@ -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 ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user