1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +01:00

PodLifeTime: update support pods with container status and pods reason (#1330)

* update support podlifetime status

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* update verify gen

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
This commit is contained in:
dongjiang
2024-01-07 00:50:32 +08:00
committed by GitHub
parent c2cf78a760
commit e7980442ef
5 changed files with 199 additions and 3 deletions

View File

@@ -44,15 +44,29 @@ func ValidatePodLifeTimeArgs(obj runtime.Object) error {
}
}
podLifeTimeAllowedStates := sets.New(
// Pod Status Phase
string(v1.PodRunning),
string(v1.PodPending),
string(v1.PodUnknown),
// Pod Status Reasons
"NodeAffinity",
"NodeLost",
"Shutdown",
"UnexpectedAdmissionError",
// Container Status Reasons
// Container state reasons: https://github.com/kubernetes/kubernetes/blob/release-1.24/pkg/kubelet/kubelet_pods.go#L76-L79
"PodInitializing",
"ContainerCreating",
// containerStatuses[*].state.waiting.reason: ImagePullBackOff
// containerStatuses[*].state.waiting.reason: ImagePullBackOff, etc.
"ImagePullBackOff",
"CrashLoopBackOff",
"CreateContainerConfigError",
"ErrImagePull",
"CreateContainerError",
"InvalidImageName",
)
if !podLifeTimeAllowedStates.HasAll(args.States...) {