diff --git a/pkg/client/unversioned/conditions.go b/pkg/client/unversioned/conditions.go index 5c284292bff..62dcdf6428e 100644 --- a/pkg/client/unversioned/conditions.go +++ b/pkg/client/unversioned/conditions.go @@ -121,6 +121,10 @@ func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions. // the pod has already reached completed state. var ErrPodCompleted = fmt.Errorf("pod ran to completion") +// ErrContainerTerminated is returned by PodContainerRunning in the intermediate +// state where the pod indicates it's still running, but its container is already terminated +var ErrContainerTerminated = fmt.Errorf("container terminated") + // PodRunning returns true if the pod is running, false if the pod has not yet reached running state, // returns ErrPodCompleted if the pod has run to completion, or an error in any other case. func PodRunning(event watch.Event) (bool, error) { @@ -217,6 +221,9 @@ func PodContainerRunning(containerName string) watch.ConditionFunc { if s.Name != containerName { continue } + if s.State.Terminated != nil { + return false, ErrContainerTerminated + } return s.State.Running != nil, nil } return false, nil