mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 13:02:14 +00:00
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.
This commit is contained in:
parent
b8990593f2
commit
8530ede61f
@ -238,6 +238,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