Merge pull request #8314 from mtrqq/remove-preemption-policy-expendable

Do not consider pod PreemptionPolicy while determining whether pod is expendable
This commit is contained in:
Kubernetes Prow Robot 2025-07-10 11:09:30 -07:00 committed by GitHub
commit 637d9ad908
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View File

@ -64,7 +64,5 @@ func FilterOutExpendablePods(pods []*apiv1.Pod, expendablePodsPriorityCutoff int
// IsExpendablePod tests if pod is expendable for give priority cutoff
func IsExpendablePod(pod *apiv1.Pod, expendablePodsPriorityCutoff int) bool {
preemptLowerPriority := pod.Spec.PreemptionPolicy == nil || *pod.Spec.PreemptionPolicy == apiv1.PreemptLowerPriority
lowPriority := pod.Spec.Priority != nil && int(*pod.Spec.Priority) < expendablePodsPriorityCutoff
return preemptLowerPriority && lowPriority
return pod.Spec.Priority != nil && int(*pod.Spec.Priority) < expendablePodsPriorityCutoff
}

View File

@ -88,7 +88,7 @@ func TestFilterOutExpendablePods(t *testing.T) {
assert.Equal(t, podWaitingForPreemption2, res[2])
}
func TestIsExpandablePod(t *testing.T) {
func TestIsExpendablePod(t *testing.T) {
preemptLowerPriorityPolicy := apiv1.PreemptLowerPriority
neverPolicy := apiv1.PreemptNever
@ -150,7 +150,7 @@ func TestIsExpandablePod(t *testing.T) {
name: "pod priority set, never preemption policy, higher cutoff",
pod: withPodPriority(BuildTestPod("p", 0, 0), -1, &neverPolicy),
cutoff: 0,
want: false,
want: true,
},
{
name: "pod priority set, never preemption policy, equal cutoff",