Skip to content

Commit 637d9ad

Browse files
authored
Merge pull request #8314 from mtrqq/remove-preemption-policy-expendable
Do not consider pod PreemptionPolicy while determining whether pod is expendable
2 parents 0ed3da3 + 6f0f000 commit 637d9ad

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

cluster-autoscaler/core/utils/expendable.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,5 @@ func FilterOutExpendablePods(pods []*apiv1.Pod, expendablePodsPriorityCutoff int
6464

6565
// IsExpendablePod tests if pod is expendable for give priority cutoff
6666
func IsExpendablePod(pod *apiv1.Pod, expendablePodsPriorityCutoff int) bool {
67-
preemptLowerPriority := pod.Spec.PreemptionPolicy == nil || *pod.Spec.PreemptionPolicy == apiv1.PreemptLowerPriority
68-
lowPriority := pod.Spec.Priority != nil && int(*pod.Spec.Priority) < expendablePodsPriorityCutoff
69-
return preemptLowerPriority && lowPriority
67+
return pod.Spec.Priority != nil && int(*pod.Spec.Priority) < expendablePodsPriorityCutoff
7068
}

cluster-autoscaler/core/utils/expendable_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestFilterOutExpendablePods(t *testing.T) {
8888
assert.Equal(t, podWaitingForPreemption2, res[2])
8989
}
9090

91-
func TestIsExpandablePod(t *testing.T) {
91+
func TestIsExpendablePod(t *testing.T) {
9292
preemptLowerPriorityPolicy := apiv1.PreemptLowerPriority
9393
neverPolicy := apiv1.PreemptNever
9494

@@ -150,7 +150,7 @@ func TestIsExpandablePod(t *testing.T) {
150150
name: "pod priority set, never preemption policy, higher cutoff",
151151
pod: withPodPriority(BuildTestPod("p", 0, 0), -1, &neverPolicy),
152152
cutoff: 0,
153-
want: false,
153+
want: true,
154154
},
155155
{
156156
name: "pod priority set, never preemption policy, equal cutoff",

0 commit comments

Comments
 (0)