kubelet: Also set PodIPs when assign a host network PodIP

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.
This commit is contained in:
Clayton Coleman 2020-03-09 18:15:32 -04:00
parent 0bb125e731
commit c26653ced9
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3

View File

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