Commit 87b40782 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #31150 from ncdc/handle-init-container-terminated-pod-running-condition

Automatic merge from submit-queue Check init containers in PodContainerRunning Sometimes when an init container runs and terminates quickly, PodContainerRunning can go into a state where the pod indicates it's still running, but the container is already terminated. Handle that condition by returning ErrContainerTerminated when it happens. See also #29952 @smarterclayton @fabianofranz
parents 8afa8c79 8530ede6
......@@ -241,6 +241,15 @@ func PodContainerRunning(containerName string) watch.ConditionFunc {
}
return s.State.Running != nil, nil
}
for _, s := range t.Status.InitContainerStatuses {
if s.Name != containerName {
continue
}
if s.State.Terminated != nil {
return false, ErrContainerTerminated
}
return s.State.Running != nil, nil
}
return false, nil
}
return false, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment