mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +01:00
Revert "Merge pull request #1164 from a7i/podlifetime-CrashLoopBackOff"
This reverts commit699297711a, reversing changes made to877d9b18ee.
This commit is contained in:
@@ -44,14 +44,12 @@ func ValidatePodLifeTimeArgs(obj runtime.Object) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
podLifeTimeAllowedStates := sets.New(
|
podLifeTimeAllowedStates := sets.New(
|
||||||
// Pod phase reasons
|
|
||||||
string(v1.PodRunning),
|
string(v1.PodRunning),
|
||||||
string(v1.PodPending),
|
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",
|
"PodInitializing",
|
||||||
"ContainerCreating",
|
"ContainerCreating",
|
||||||
"CrashLoopBackOff",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if !podLifeTimeAllowedStates.HasAll(args.States...) {
|
if !podLifeTimeAllowedStates.HasAll(args.States...) {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
utilpointer "k8s.io/utils/pointer"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
|
func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
|
||||||
@@ -32,7 +31,7 @@ func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
|
|||||||
{
|
{
|
||||||
description: "valid arg, no errors",
|
description: "valid arg, no errors",
|
||||||
args: &PodLifeTimeArgs{
|
args: &PodLifeTimeArgs{
|
||||||
MaxPodLifeTimeSeconds: utilpointer.Uint(1),
|
MaxPodLifeTimeSeconds: func(i uint) *uint { return &i }(1),
|
||||||
States: []string{string(v1.PodRunning)},
|
States: []string{string(v1.PodRunning)},
|
||||||
},
|
},
|
||||||
expectError: false,
|
expectError: false,
|
||||||
@@ -51,14 +50,6 @@ func TestValidateRemovePodLifeTimeArgs(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectError: true,
|
expectError: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
description: "allows CrashLoopBackOff state",
|
|
||||||
args: &PodLifeTimeArgs{
|
|
||||||
MaxPodLifeTimeSeconds: utilpointer.Uint(1),
|
|
||||||
States: []string{"CrashLoopBackOff"},
|
|
||||||
},
|
|
||||||
expectError: false,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
|||||||
Reference in New Issue
Block a user