From 9aad51f328a2aafefa3374b98def090e2a3b7445 Mon Sep 17 00:00:00 2001 From: Amir Alavi Date: Wed, 7 Jun 2023 21:00:47 -0400 Subject: [PATCH] Revert "Merge pull request #1164 from a7i/podlifetime-CrashLoopBackOff" This reverts commit 699297711a5ac3661e2362b36d37ba8e87d3b32d, reversing changes made to 877d9b18ee5e06485c4fa363a48ec590f2859244. --- pkg/framework/plugins/podlifetime/validation.go | 4 +--- pkg/framework/plugins/podlifetime/validation_test.go | 11 +---------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/pkg/framework/plugins/podlifetime/validation.go b/pkg/framework/plugins/podlifetime/validation.go index 02188f940..973dceb6a 100644 --- a/pkg/framework/plugins/podlifetime/validation.go +++ b/pkg/framework/plugins/podlifetime/validation.go @@ -44,14 +44,12 @@ func ValidatePodLifeTimeArgs(obj runtime.Object) error { } } podLifeTimeAllowedStates := sets.New( - // Pod phase reasons string(v1.PodRunning), string(v1.PodPending), - // Container state reasons + // Container state reasons: https://github.com/kubernetes/kubernetes/blob/release-1.24/pkg/kubelet/kubelet_pods.go#L76-L79 "PodInitializing", "ContainerCreating", - "CrashLoopBackOff", ) if !podLifeTimeAllowedStates.HasAll(args.States...) { diff --git a/pkg/framework/plugins/podlifetime/validation_test.go b/pkg/framework/plugins/podlifetime/validation_test.go index 3dfe280af..b42797427 100644 --- a/pkg/framework/plugins/podlifetime/validation_test.go +++ b/pkg/framework/plugins/podlifetime/validation_test.go @@ -20,7 +20,6 @@ import ( "testing" v1 "k8s.io/api/core/v1" - utilpointer "k8s.io/utils/pointer" ) func TestValidateRemovePodLifeTimeArgs(t *testing.T) { @@ -32,7 +31,7 @@ func TestValidateRemovePodLifeTimeArgs(t *testing.T) { { description: "valid arg, no errors", args: &PodLifeTimeArgs{ - MaxPodLifeTimeSeconds: utilpointer.Uint(1), + MaxPodLifeTimeSeconds: func(i uint) *uint { return &i }(1), States: []string{string(v1.PodRunning)}, }, expectError: false, @@ -51,14 +50,6 @@ func TestValidateRemovePodLifeTimeArgs(t *testing.T) { }, expectError: true, }, - { - description: "allows CrashLoopBackOff state", - args: &PodLifeTimeArgs{ - MaxPodLifeTimeSeconds: utilpointer.Uint(1), - States: []string{"CrashLoopBackOff"}, - }, - expectError: false, - }, } for _, tc := range testCases {