File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
pkg/framework/plugins/podlifetime Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,14 @@ func ValidatePodLifeTimeArgs(obj runtime.Object) error {
4444 }
4545 }
4646 podLifeTimeAllowedStates := sets .New (
47+ // Pod phase reasons
4748 string (v1 .PodRunning ),
4849 string (v1 .PodPending ),
4950
50- // Container state reasons: https://github.com/kubernetes/kubernetes/blob/release-1.24/pkg/kubelet/kubelet_pods.go#L76-L79
51+ // Container state reasons
5152 "PodInitializing" ,
5253 "ContainerCreating" ,
54+ "CrashLoopBackOff" ,
5355 )
5456
5557 if ! podLifeTimeAllowedStates .HasAll (args .States ... ) {
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
2020 "testing"
2121
2222 v1 "k8s.io/api/core/v1"
23+ utilpointer "k8s.io/utils/pointer"
2324)
2425
2526func TestValidateRemovePodLifeTimeArgs (t * testing.T ) {
@@ -31,7 +32,7 @@ func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
3132 {
3233 description : "valid arg, no errors" ,
3334 args : & PodLifeTimeArgs {
34- MaxPodLifeTimeSeconds : func ( i uint ) * uint { return & i } (1 ),
35+ MaxPodLifeTimeSeconds : utilpointer . Uint (1 ),
3536 States : []string {string (v1 .PodRunning )},
3637 },
3738 expectError : false ,
@@ -50,6 +51,14 @@ func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
5051 },
5152 expectError : true ,
5253 },
54+ {
55+ description : "allows CrashLoopBackOff state" ,
56+ args : & PodLifeTimeArgs {
57+ MaxPodLifeTimeSeconds : utilpointer .Uint (1 ),
58+ States : []string {"CrashLoopBackOff" },
59+ },
60+ expectError : false ,
61+ },
5362 }
5463
5564 for _ , tc := range testCases {
You can’t perform that action at this time.
0 commit comments