mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
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
This commit is contained in:
commit
87b40782c9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user