From deb4822cdd10c27b0700f1e9cc6e6de15dad9d54 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Wed, 25 Oct 2017 23:59:27 -0600 Subject: [PATCH] UPSTREAM: 54593: Removed containers are not always waiting --- vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go b/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go index 895fd233a931..162030fe5baa 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go @@ -1278,16 +1278,21 @@ func (kl *Kubelet) convertStatusToAPIStatus(pod *v1.Pod, podStatus *kubecontaine // set status for Pods created on versions of kube older than 1.6 apiPodStatus.QOSClass = v1qos.GetPodQOS(pod) + oldPodStatus, found := kl.statusManager.GetPodStatus(pod.UID) + if !found { + oldPodStatus = pod.Status + } + apiPodStatus.ContainerStatuses = kl.convertToAPIContainerStatuses( pod, podStatus, - pod.Status.ContainerStatuses, + oldPodStatus.ContainerStatuses, pod.Spec.Containers, len(pod.Spec.InitContainers) > 0, false, ) apiPodStatus.InitContainerStatuses = kl.convertToAPIContainerStatuses( pod, podStatus, - pod.Status.InitContainerStatuses, + oldPodStatus.InitContainerStatuses, pod.Spec.InitContainers, len(pod.Spec.InitContainers) > 0, true, @@ -1354,7 +1359,7 @@ func (kl *Kubelet) convertToAPIContainerStatuses(pod *v1.Pod, podStatus *kubecon } oldStatus, found := oldStatuses[container.Name] if found { - if isInitContainer && oldStatus.State.Terminated != nil { + if oldStatus.State.Terminated != nil { // Do not update status on terminated init containers as // they be removed at any time. status = &oldStatus