@@ -35,8 +35,8 @@ import (
35
35
"k8s.io/client-go/kubernetes"
36
36
corelisters "k8s.io/client-go/listers/core/v1"
37
37
policylisters "k8s.io/client-go/listers/policy/v1beta1"
38
+ corev1helpers "k8s.io/component-helpers/scheduling/corev1"
38
39
extenderv1 "k8s.io/kube-scheduler/extender/v1"
39
- podutil "k8s.io/kubernetes/pkg/api/v1/pod"
40
40
kubefeatures "k8s.io/kubernetes/pkg/features"
41
41
"k8s.io/kubernetes/pkg/scheduler/core"
42
42
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
@@ -206,9 +206,9 @@ func PodEligibleToPreemptOthers(pod *v1.Pod, nodeInfos framework.NodeInfoLister,
206
206
}
207
207
208
208
if nodeInfo , _ := nodeInfos .Get (nomNodeName ); nodeInfo != nil {
209
- podPriority := podutil . GetPodPriority (pod )
209
+ podPriority := corev1helpers . PodPriority (pod )
210
210
for _ , p := range nodeInfo .Pods {
211
- if p .Pod .DeletionTimestamp != nil && podutil . GetPodPriority (p .Pod ) < podPriority {
211
+ if p .Pod .DeletionTimestamp != nil && corev1helpers . PodPriority (p .Pod ) < podPriority {
212
212
// There is a terminating pod on the nominated node.
213
213
return false
214
214
}
@@ -392,7 +392,7 @@ func pickOneNodeForPreemption(nodesToVictims map[string]*extenderv1.Victims) str
392
392
node := minNodes1 [i ]
393
393
victims := nodesToVictims [node ]
394
394
// highestPodPriority is the highest priority among the victims on this node.
395
- highestPodPriority := podutil . GetPodPriority (victims .Pods [0 ])
395
+ highestPodPriority := corev1helpers . PodPriority (victims .Pods [0 ])
396
396
if highestPodPriority < minHighestPriority {
397
397
minHighestPriority = highestPodPriority
398
398
lenNodes2 = 0
@@ -418,7 +418,7 @@ func pickOneNodeForPreemption(nodesToVictims map[string]*extenderv1.Victims) str
418
418
// needed so that a node with a few pods with negative priority is not
419
419
// picked over a node with a smaller number of pods with the same negative
420
420
// priority (and similar scenarios).
421
- sumPriorities += int64 (podutil . GetPodPriority (pod )) + int64 (math .MaxInt32 + 1 )
421
+ sumPriorities += int64 (corev1helpers . PodPriority (pod )) + int64 (math .MaxInt32 + 1 )
422
422
}
423
423
if sumPriorities < minSumPriorities {
424
424
minSumPriorities = sumPriorities
@@ -525,9 +525,9 @@ func selectVictimsOnNode(
525
525
}
526
526
// As the first step, remove all the lower priority pods from the node and
527
527
// check if the given pod can be scheduled.
528
- podPriority := podutil . GetPodPriority (pod )
528
+ podPriority := corev1helpers . PodPriority (pod )
529
529
for _ , p := range nodeInfo .Pods {
530
- if podutil . GetPodPriority (p .Pod ) < podPriority {
530
+ if corev1helpers . PodPriority (p .Pod ) < podPriority {
531
531
potentialVictims = append (potentialVictims , p .Pod )
532
532
if err := removePod (p .Pod ); err != nil {
533
533
return nil , 0 , false
@@ -639,9 +639,9 @@ func getLowerPriorityNominatedPods(pn framework.PodNominator, pod *v1.Pod, nodeN
639
639
}
640
640
641
641
var lowerPriorityPods []* v1.Pod
642
- podPriority := podutil . GetPodPriority (pod )
642
+ podPriority := corev1helpers . PodPriority (pod )
643
643
for _ , p := range pods {
644
- if podutil . GetPodPriority (p ) < podPriority {
644
+ if corev1helpers . PodPriority (p ) < podPriority {
645
645
lowerPriorityPods = append (lowerPriorityPods , p )
646
646
}
647
647
}
0 commit comments