diff --git a/cluster-autoscaler/core/utils/expendable.go b/cluster-autoscaler/core/utils/expendable.go index af94863941..f011a35789 100644 --- a/cluster-autoscaler/core/utils/expendable.go +++ b/cluster-autoscaler/core/utils/expendable.go @@ -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 } diff --git a/cluster-autoscaler/core/utils/expendable_test.go b/cluster-autoscaler/core/utils/expendable_test.go index a198c30986..a51ff723a8 100644 --- a/cluster-autoscaler/core/utils/expendable_test.go +++ b/cluster-autoscaler/core/utils/expendable_test.go @@ -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",