UPSTREAM: 51644: do not update init containers status if terminated
@@ -1315,11 +1315,18 @@ func (kl *Kubelet) convertToAPIContainerStatuses(pod *v1.Pod, podStatus *kubecon
Image: container.Image,
State: defaultWaitingState,
}
+ oldStatus, found := oldStatuses[container.Name]
+ if found {
+ if isInitContainer && oldStatus.State.Terminated != nil {
+ // Do not update status on terminated init containers as
+ // they be removed at any time.
+ status = &oldStatus
+ } else {
// Apply some values from the old statuses as the default values.
- if oldStatus, found := oldStatuses[container.Name]; found {
status.RestartCount = oldStatus.RestartCount
status.LastTerminationState = oldStatus.LastTerminationState
}
+ }
statuses[container.Name] = status
}
