mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
kubelet: If the container status is created, we are waiting
If CRI returns a container that has been created but is not running, it is not safe to assume it is terminal, as our connection to CRI may have failed. Instead, created is treated as waiting, as in "waiting for this container to start". Either syncPod or syncTerminatingPod is responsible for handling this state.
This commit is contained in:
parent
a5d28a638f
commit
b638bd8b03
@ -1632,12 +1632,8 @@ func (kl *Kubelet) convertToAPIContainerStatuses(pod *v1.Pod, podStatus *kubecon
|
||||
case cs.State == kubecontainer.ContainerStateRunning:
|
||||
status.State.Running = &v1.ContainerStateRunning{StartedAt: metav1.NewTime(cs.StartedAt)}
|
||||
case cs.State == kubecontainer.ContainerStateCreated:
|
||||
// Treat containers in the "created" state as if they are exited.
|
||||
// The pod workers are supposed start all containers it creates in
|
||||
// one sync (syncPod) iteration. There should not be any normal
|
||||
// "created" containers when the pod worker generates the status at
|
||||
// the beginning of a sync iteration.
|
||||
fallthrough
|
||||
// containers that are created but not running are "waiting to be running"
|
||||
status.State.Waiting = &v1.ContainerStateWaiting{}
|
||||
case cs.State == kubecontainer.ContainerStateExited:
|
||||
status.State.Terminated = &v1.ContainerStateTerminated{
|
||||
ExitCode: int32(cs.ExitCode),
|
||||
|
Loading…
Reference in New Issue
Block a user