Kubelet provides an updated and complete status of local-static Pods
This commit is contained in:
parent
db8335f4a9
commit
4c289014a0
@ -142,7 +142,15 @@ func (kl *Kubelet) getPodContainerDir(podUID types.UID, ctrName string) string {
|
|||||||
// GetPods returns all pods bound to the kubelet and their spec, and the mirror
|
// GetPods returns all pods bound to the kubelet and their spec, and the mirror
|
||||||
// pods.
|
// pods.
|
||||||
func (kl *Kubelet) GetPods() []*v1.Pod {
|
func (kl *Kubelet) GetPods() []*v1.Pod {
|
||||||
return kl.podManager.GetPods()
|
pods := kl.podManager.GetPods()
|
||||||
|
// a kubelet running without apiserver requires an additional
|
||||||
|
// update of the static pod status. See #57106
|
||||||
|
for _, p := range pods {
|
||||||
|
if status, ok := kl.statusManager.GetPodStatus(p.UID); ok {
|
||||||
|
p.Status = status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pods
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRunningPods returns all pods running on kubelet from looking at the
|
// GetRunningPods returns all pods running on kubelet from looking at the
|
||||||
|
@ -1359,18 +1359,15 @@ func (kl *Kubelet) generateAPIPodStatus(pod *v1.Pod, podStatus *kubecontainer.Po
|
|||||||
Status: v1.ConditionTrue,
|
Status: v1.ConditionTrue,
|
||||||
})
|
})
|
||||||
|
|
||||||
if kl.kubeClient != nil {
|
hostIP, err := kl.getHostIPAnyWay()
|
||||||
hostIP, err := kl.getHostIPAnyWay()
|
if err != nil {
|
||||||
if err != nil {
|
glog.V(4).Infof("Cannot get host IP: %v", err)
|
||||||
glog.V(4).Infof("Cannot get host IP: %v", err)
|
return *s
|
||||||
} else {
|
}
|
||||||
s.HostIP = hostIP.String()
|
s.HostIP = hostIP.String()
|
||||||
if kubecontainer.IsHostNetworkPod(pod) && s.PodIP == "" {
|
if kubecontainer.IsHostNetworkPod(pod) && s.PodIP == "" {
|
||||||
s.PodIP = hostIP.String()
|
s.PodIP = hostIP.String()
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *s
|
return *s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user