mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
kubelet: retry pod sandbox creation when containers were never created
If kubelet never gets past sandbox creation (i.e., never attempted to create containers for a pod), it should retry the sandbox creation on failure, regardless of the restart policy of the pod.
This commit is contained in:
@@ -472,11 +472,15 @@ func (m *kubeGenericRuntimeManager) computePodActions(pod *v1.Pod, podStatus *ku
|
||||
// If we need to (re-)create the pod sandbox, everything will need to be
|
||||
// killed and recreated, and init containers should be purged.
|
||||
if createPodSandbox {
|
||||
if !shouldRestartOnFailure(pod) && attempt != 0 {
|
||||
if !shouldRestartOnFailure(pod) && attempt != 0 && len(podStatus.ContainerStatuses) != 0 {
|
||||
// Should not restart the pod, just return.
|
||||
// we should not create a sandbox for a pod if it is already done.
|
||||
// if all containers are done and should not be started, there is no need to create a new sandbox.
|
||||
// this stops confusing logs on pods whose containers all have exit codes, but we recreate a sandbox before terminating it.
|
||||
//
|
||||
// If ContainerStatuses is empty, we assume that we've never
|
||||
// successfully created any containers. In this case, we should
|
||||
// retry creating the sandbox.
|
||||
changes.CreateSandbox = false
|
||||
return changes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user