Merge pull request #127207 from SergeyKanzhelev/automated-cherry-pick-of-#126343-upstream-release-1.31

Automated cherry pick of #126343: Terminated pod should not be re-admitted
This commit is contained in:
Kubernetes Prow Robot
2024-09-09 22:05:54 +01:00
committed by GitHub
2 changed files with 94 additions and 1 deletions

View File

@@ -2567,7 +2567,8 @@ func (kl *Kubelet) HandlePodAdditions(pods []*v1.Pod) {
// shutting it down. If the pod hasn't started yet, we know that when
// the pod worker is invoked it will also avoid setting up the pod, so
// we simply avoid doing any work.
if !kl.podWorkers.IsPodTerminationRequested(pod.UID) {
// We also do not try to admit the pod that is already in terminated state.
if !kl.podWorkers.IsPodTerminationRequested(pod.UID) && !podutil.IsPodPhaseTerminal(pod.Status.Phase) {
// We failed pods that we rejected, so activePods include all admitted
// pods that are alive.
activePods := kl.filterOutInactivePods(existingPods)