Skip to content

Commit 6f0f000

Browse files
committed
Do not consider pod PreemptionPolicy while determining whether pod is expendable
Change #6577 added a support for considering preemption policies into expendable pods evaluation, this is not correct as this propepty describes whether the created pod can evict other pods - thus should be considered only within scheduler and its framework. This change removes the policy out of the consideration
1 parent 2945e95 commit 6f0f000

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)