From c26653ced913e9fd3ecbdfdf353156515d4d71e7 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Mon, 9 Mar 2020 18:15:32 -0400 Subject: [PATCH] kubelet: Also set PodIPs when assign a host network PodIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we clobber PodIP we should also overwrite PodIPs and not rely on the apiserver to fix it for us - this caused the Kubelet status manager to report a large string of the following warnings when it tried to reconcile a host network pod: ``` I0309 19:41:05.283623 1326 status_manager.go:846] Pod status is inconsistent with cached status for pod "machine-config-daemon-jvwz4_openshift-machine-config-operator(61176279-f752-4e1c-ac8a-b48f0a68d54a)", a reconciliation should be triggered:   &v1.PodStatus{    ... // 5 identical fields    HostIP: "10.0.32.2",    PodIP: "10.0.32.2", -  PodIPs: []v1.PodIP{{IP: "10.0.32.2"}}, +  PodIPs: []v1.PodIP{},    StartTime: s"2020-03-09 19:41:05 +0000 UTC",    InitContainerStatuses: nil,    ... // 3 identical fields   } ``` With the changes to the apiserver, this only happens once, but it is still a bug. --- pkg/kubelet/kubelet_pods.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/kubelet/kubelet_pods.go b/pkg/kubelet/kubelet_pods.go index 99e35f32db0..9d45549bf64 100644 --- a/pkg/kubelet/kubelet_pods.go +++ b/pkg/kubelet/kubelet_pods.go @@ -1399,6 +1399,7 @@ func (kl *Kubelet) generateAPIPodStatus(pod *v1.Pod, podStatus *kubecontainer.Po s.HostIP = hostIP.String() if kubecontainer.IsHostNetworkPod(pod) && s.PodIP == "" { s.PodIP = hostIP.String() + s.PodIPs = []v1.PodIP{{IP: s.PodIP}} } } }