Skip to content

Commit

Permalink
Merge pull request #54883 from dashpole/automated-cherry-pick-of-#545…
Browse files Browse the repository at this point in the history
…93-upstream-release-1.8

Automatic merge from submit-queue.

Automated cherry pick of #54593

Cherry pick of #54593 on release-1.8.

#54593: fix #54499. Removed containers are not waiting

```release-note
Fix an issue where pods were briefly transitioned to a "Pending" state during the deletion process.
```
  • Loading branch information
Kubernetes Submit Queue committed Nov 2, 2017
2 parents 8478c92 + 02cf95b commit 54c3bd7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/kubelet/kubelet_pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -1348,16 +1348,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,
Expand Down Expand Up @@ -1424,7 +1429,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
Expand Down

0 comments on commit 54c3bd7

Please sign in to comment.