Skip to content

Commit

Permalink
Sync the status of static Pods
Browse files Browse the repository at this point in the history
  • Loading branch information
yutedz committed Dec 12, 2019
1 parent 6c190d2 commit 67d2a34
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/kubelet/kubelet_getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/cm"
"k8s.io/kubernetes/pkg/kubelet/config"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
kubelettypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/util/mount"
utilnode "k8s.io/kubernetes/pkg/util/node"
utilpath "k8s.io/utils/path"
Expand Down Expand Up @@ -166,8 +167,11 @@ func (kl *Kubelet) GetPods() []*v1.Pod {
// 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
if kubelettypes.IsStaticPod(p) {
if status, ok := kl.statusManager.GetPodStatus(p.UID); ok {
klog.V(2).Infof("status for pod %v updated to %v", p.Name, status)
p.Status = status
}
}
}
return pods
Expand Down

0 comments on commit 67d2a34

Please sign in to comment.