Skip to content

Commit 8a12334

Browse files
authored
Merge pull request kubernetes#83386 from draveness/feature/get-rid-of-max-priority
feat(scheduler): remove MaxPriority in the scheduler api
2 parents 514ea6f + 9769d49 commit 8a12334

32 files changed

+166
-214
lines changed

pkg/scheduler/algorithm/priorities/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ go_library(
3636
"//pkg/scheduler/algorithm:go_default_library",
3737
"//pkg/scheduler/algorithm/predicates:go_default_library",
3838
"//pkg/scheduler/algorithm/priorities/util:go_default_library",
39-
"//pkg/scheduler/api:go_default_library",
4039
"//pkg/scheduler/framework/v1alpha1:go_default_library",
4140
"//pkg/scheduler/nodeinfo:go_default_library",
4241
"//pkg/scheduler/util:go_default_library",
@@ -77,7 +76,6 @@ go_test(
7776
"//pkg/features:go_default_library",
7877
"//pkg/scheduler/algorithm:go_default_library",
7978
"//pkg/scheduler/algorithm/priorities/util:go_default_library",
80-
"//pkg/scheduler/api:go_default_library",
8179
"//pkg/scheduler/framework/v1alpha1:go_default_library",
8280
"//pkg/scheduler/nodeinfo:go_default_library",
8381
"//pkg/scheduler/testing:go_default_library",

pkg/scheduler/algorithm/priorities/balanced_resource_allocation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
v1 "k8s.io/api/core/v1"
2323
utilfeature "k8s.io/apiserver/pkg/util/feature"
2424
"k8s.io/kubernetes/pkg/features"
25-
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
25+
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
2626
)
2727

2828
var (
@@ -60,15 +60,15 @@ func balancedResourceScorer(requested, allocable ResourceToValueMap, includeVolu
6060
// Since the variance is between positive fractions, it will be positive fraction. 1-variance lets the
6161
// score to be higher for node which has least variance and multiplying it with 10 provides the scaling
6262
// factor needed.
63-
return int64((1 - variance) * float64(schedulerapi.MaxPriority))
63+
return int64((1 - variance) * float64(framework.MaxNodeScore))
6464
}
6565

6666
// Upper and lower boundary of difference between cpuFraction and memoryFraction are -1 and 1
6767
// respectively. Multiplying the absolute value of the difference by 10 scales the value to
6868
// 0-10 with 0 representing well balanced allocation and 10 poorly balanced. Subtracting it from
6969
// 10 leads to the score which also scales from 0 to 10 while 10 representing well balanced.
7070
diff := math.Abs(cpuFraction - memoryFraction)
71-
return int64((1 - diff) * float64(schedulerapi.MaxPriority))
71+
return int64((1 - diff) * float64(framework.MaxNodeScore))
7272
}
7373

7474
func fractionOfCapacity(requested, capacity int64) float64 {

pkg/scheduler/algorithm/priorities/balanced_resource_allocation_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
utilfeature "k8s.io/apiserver/pkg/util/feature"
2727
featuregatetesting "k8s.io/component-base/featuregate/testing"
2828
"k8s.io/kubernetes/pkg/features"
29-
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
3029
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
3130
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
3231
)
@@ -233,7 +232,7 @@ func TestBalancedResourceAllocation(t *testing.T) {
233232
*/
234233
pod: &v1.Pod{Spec: noResources},
235234
nodes: []*v1.Node{makeNode("machine1", 4000, 10000), makeNode("machine2", 4000, 10000)},
236-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: schedulerapi.MaxPriority}},
235+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}},
237236
name: "nothing scheduled, nothing requested",
238237
},
239238
{
@@ -250,7 +249,7 @@ func TestBalancedResourceAllocation(t *testing.T) {
250249
*/
251250
pod: &v1.Pod{Spec: cpuAndMemory},
252251
nodes: []*v1.Node{makeNode("machine1", 4000, 10000), makeNode("machine2", 6000, 10000)},
253-
expectedList: []framework.NodeScore{{Name: "machine1", Score: 7}, {Name: "machine2", Score: schedulerapi.MaxPriority}},
252+
expectedList: []framework.NodeScore{{Name: "machine1", Score: 7}, {Name: "machine2", Score: framework.MaxNodeScore}},
254253
name: "nothing scheduled, resources requested, differently sized machines",
255254
},
256255
{
@@ -267,7 +266,7 @@ func TestBalancedResourceAllocation(t *testing.T) {
267266
*/
268267
pod: &v1.Pod{Spec: noResources},
269268
nodes: []*v1.Node{makeNode("machine1", 4000, 10000), makeNode("machine2", 4000, 10000)},
270-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: schedulerapi.MaxPriority}},
269+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}},
271270
name: "no resources requested, pods scheduled",
272271
pods: []*v1.Pod{
273272
{Spec: machine1Spec, ObjectMeta: metav1.ObjectMeta{Labels: labels2}},

pkg/scheduler/algorithm/priorities/even_pods_spread.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ import (
2121
"math"
2222
"sync/atomic"
2323

24-
"k8s.io/api/core/v1"
24+
v1 "k8s.io/api/core/v1"
2525
"k8s.io/client-go/util/workqueue"
2626
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
27-
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
2827
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
2928
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
3029
schedutil "k8s.io/kubernetes/pkg/scheduler/util"
@@ -187,10 +186,10 @@ func CalculateEvenPodsSpreadPriority(pod *v1.Pod, nodeNameToInfo map[string]*sch
187186
continue
188187
}
189188
if maxMinDiff == 0 {
190-
result[i].Score = schedulerapi.MaxPriority
189+
result[i].Score = framework.MaxNodeScore
191190
continue
192191
}
193-
fScore := float64(schedulerapi.MaxPriority) * (float64(total-t.nodeNameToPodCounts[node.Name]) / float64(maxMinDiff))
192+
fScore := float64(framework.MaxNodeScore) * (float64(total-t.nodeNameToPodCounts[node.Name]) / float64(maxMinDiff))
194193
result[i].Score = int64(fScore)
195194
}
196195

pkg/scheduler/algorithm/priorities/image_locality.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import (
2020
"fmt"
2121
"strings"
2222

23-
"k8s.io/api/core/v1"
24-
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
23+
v1 "k8s.io/api/core/v1"
2524
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
2625
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
2726
"k8s.io/kubernetes/pkg/util/parsers"
@@ -69,7 +68,7 @@ func calculatePriority(sumScores int64) int {
6968
sumScores = maxThreshold
7069
}
7170

72-
return int(int64(schedulerapi.MaxPriority) * (sumScores - minThreshold) / (maxThreshold - minThreshold))
71+
return int(int64(framework.MaxNodeScore) * (sumScores - minThreshold) / (maxThreshold - minThreshold))
7372
}
7473

7574
// sumImageScores returns the sum of image scores of all the containers that are already on the node.

pkg/scheduler/algorithm/priorities/image_locality_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ import (
2222
"reflect"
2323
"testing"
2424

25-
"k8s.io/api/core/v1"
25+
v1 "k8s.io/api/core/v1"
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27-
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
2827
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
2928
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
3029
"k8s.io/kubernetes/pkg/util/parsers"
@@ -159,7 +158,7 @@ func TestImageLocalityPriority(t *testing.T) {
159158
// Score: 0 (10M/2 < 23M, min-threshold)
160159
pod: &v1.Pod{Spec: testMinMax},
161160
nodes: []*v1.Node{makeImageNode("machine1", node403002000), makeImageNode("machine2", node25010)},
162-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: 0}},
161+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: 0}},
163162
name: "if exceed limit, use limit",
164163
},
165164
{

pkg/scheduler/algorithm/priorities/interpod_affinity.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ import (
2020
"context"
2121
"sync/atomic"
2222

23-
"k8s.io/api/core/v1"
23+
v1 "k8s.io/api/core/v1"
2424
apierrors "k8s.io/apimachinery/pkg/api/errors"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626
"k8s.io/client-go/util/workqueue"
2727
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
2828
priorityutil "k8s.io/kubernetes/pkg/scheduler/algorithm/priorities/util"
29-
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
3029
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
3130
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
3231
schedutil "k8s.io/kubernetes/pkg/scheduler/util"
@@ -225,7 +224,7 @@ func (ipa *InterPodAffinity) CalculateInterPodAffinityPriority(pod *v1.Pod, node
225224
for i, node := range nodes {
226225
fScore := float64(0)
227226
if maxMinDiff > 0 {
228-
fScore = float64(schedulerapi.MaxPriority) * (float64(pm.counts[i]-minCount) / float64(maxCount-minCount))
227+
fScore = float64(framework.MaxNodeScore) * (float64(pm.counts[i]-minCount) / float64(maxCount-minCount))
229228
}
230229
result = append(result, framework.NodeScore{Name: node.Name, Score: int64(fScore)})
231230
if klog.V(10) {

pkg/scheduler/algorithm/priorities/interpod_affinity_test.go

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ import (
2121
"reflect"
2222
"testing"
2323

24-
"k8s.io/api/core/v1"
24+
v1 "k8s.io/api/core/v1"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26-
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
2726
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
2827
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
2928
st "k8s.io/kubernetes/pkg/scheduler/testing"
@@ -295,7 +294,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
295294
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}},
296295
{ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}},
297296
},
298-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: 0}, {Name: "machine3", Score: 0}},
297+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: 0}, {Name: "machine3", Score: 0}},
299298
name: "Affinity: pod that matches topology key & pods in nodes will get high score comparing to others" +
300299
"which doesn't match either pods in nodes or in topology key",
301300
},
@@ -313,7 +312,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
313312
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgChinaAzAz1}},
314313
{ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelRgIndia}},
315314
},
316-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: schedulerapi.MaxPriority}, {Name: "machine3", Score: 0}},
315+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}, {Name: "machine3", Score: 0}},
317316
name: "All the nodes that have the same topology key & label value with one of them has an existing pod that match the affinity rules, have the same score",
318317
},
319318
// there are 2 regions, say regionChina(machine1,machine3,machine4) and regionIndia(machine2,machine5), both regions have nodes that match the preference.
@@ -337,7 +336,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
337336
{ObjectMeta: metav1.ObjectMeta{Name: "machine4", Labels: labelRgChina}},
338337
{ObjectMeta: metav1.ObjectMeta{Name: "machine5", Labels: labelRgIndia}},
339338
},
340-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: 5}, {Name: "machine3", Score: schedulerapi.MaxPriority}, {Name: "machine4", Score: schedulerapi.MaxPriority}, {Name: "machine5", Score: 5}},
339+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: 5}, {Name: "machine3", Score: framework.MaxNodeScore}, {Name: "machine4", Score: framework.MaxNodeScore}, {Name: "machine5", Score: 5}},
341340
name: "Affinity: nodes in one region has more matching pods comparing to other reqion, so the region which has more macthes will get high score",
342341
},
343342
// Test with the different operators and values for pod affinity scheduling preference, including some match failures.
@@ -353,7 +352,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
353352
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}},
354353
{ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}},
355354
},
356-
expectedList: []framework.NodeScore{{Name: "machine1", Score: 2}, {Name: "machine2", Score: schedulerapi.MaxPriority}, {Name: "machine3", Score: 0}},
355+
expectedList: []framework.NodeScore{{Name: "machine1", Score: 2}, {Name: "machine2", Score: framework.MaxNodeScore}, {Name: "machine3", Score: 0}},
357356
name: "Affinity: different Label operators and values for pod affinity scheduling preference, including some match failures ",
358357
},
359358
// Test the symmetry cases for affinity, the difference between affinity and symmetry is not the pod wants to run together with some existing pods,
@@ -369,7 +368,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
369368
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}},
370369
{ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}},
371370
},
372-
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: schedulerapi.MaxPriority}, {Name: "machine3", Score: 0}},
371+
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: framework.MaxNodeScore}, {Name: "machine3", Score: 0}},
373372
name: "Affinity symmetry: considred only the preferredDuringSchedulingIgnoredDuringExecution in pod affinity symmetry",
374373
},
375374
{
@@ -383,7 +382,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
383382
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}},
384383
{ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}},
385384
},
386-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: schedulerapi.MaxPriority}, {Name: "machine3", Score: 0}},
385+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}, {Name: "machine3", Score: 0}},
387386
name: "Affinity symmetry: considred RequiredDuringSchedulingIgnoredDuringExecution in pod affinity symmetry",
388387
},
389388

@@ -403,7 +402,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
403402
{ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelAzAz1}},
404403
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgChina}},
405404
},
406-
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: schedulerapi.MaxPriority}},
405+
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: framework.MaxNodeScore}},
407406
name: "Anti Affinity: pod that doesnot match existing pods in node will get high score ",
408407
},
409408
{
@@ -416,7 +415,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
416415
{ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelAzAz1}},
417416
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgChina}},
418417
},
419-
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: schedulerapi.MaxPriority}},
418+
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: framework.MaxNodeScore}},
420419
name: "Anti Affinity: pod that does not matches topology key & matches the pods in nodes will get higher score comparing to others ",
421420
},
422421
{
@@ -430,7 +429,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
430429
{ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelAzAz1}},
431430
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}},
432431
},
433-
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: schedulerapi.MaxPriority}},
432+
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: framework.MaxNodeScore}},
434433
name: "Anti Affinity: one node has more matching pods comparing to other node, so the node which has more unmacthes will get high score",
435434
},
436435
// Test the symmetry cases for anti affinity
@@ -444,7 +443,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
444443
{ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelAzAz1}},
445444
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelAzAz2}},
446445
},
447-
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: schedulerapi.MaxPriority}},
446+
expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: framework.MaxNodeScore}},
448447
name: "Anti Affinity symmetry: the existing pods in node which has anti affinity match will get high score",
449448
},
450449
// Test both affinity and anti-affinity
@@ -458,7 +457,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
458457
{ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelRgChina}},
459458
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelAzAz1}},
460459
},
461-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: 0}},
460+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: 0}},
462461
name: "Affinity and Anti Affinity: considered only preferredDuringSchedulingIgnoredDuringExecution in both pod affinity & anti affinity",
463462
},
464463
// Combined cases considering both affinity and anti-affinity, the pod to schedule and existing pods have the same labels (they are in the same RC/service),
@@ -483,7 +482,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
483482
{ObjectMeta: metav1.ObjectMeta{Name: "machine4", Labels: labelRgChina}},
484483
{ObjectMeta: metav1.ObjectMeta{Name: "machine5", Labels: labelRgIndia}},
485484
},
486-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: 4}, {Name: "machine3", Score: schedulerapi.MaxPriority}, {Name: "machine4", Score: schedulerapi.MaxPriority}, {Name: "machine5", Score: 4}},
485+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: 4}, {Name: "machine3", Score: framework.MaxNodeScore}, {Name: "machine4", Score: framework.MaxNodeScore}, {Name: "machine5", Score: 4}},
487486
name: "Affinity and Anti Affinity: considering both affinity and anti-affinity, the pod to schedule and existing pods have the same labels",
488487
},
489488
// Consider Affinity, Anti Affinity and symmetry together.
@@ -505,7 +504,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
505504
{ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelRgIndia}},
506505
{ObjectMeta: metav1.ObjectMeta{Name: "machine4", Labels: labelAzAz2}},
507506
},
508-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: 0}, {Name: "machine3", Score: schedulerapi.MaxPriority}, {Name: "machine4", Score: 0}},
507+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: 0}, {Name: "machine3", Score: framework.MaxNodeScore}, {Name: "machine4", Score: 0}},
509508
name: "Affinity and Anti Affinity and symmetry: considered only preferredDuringSchedulingIgnoredDuringExecution in both pod affinity & anti affinity & symmetry",
510509
},
511510
// Cover https://github.com/kubernetes/kubernetes/issues/82796 which panics upon:
@@ -521,7 +520,7 @@ func TestInterPodAffinityPriority(t *testing.T) {
521520
{ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelRgChina}},
522521
{ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgChina}},
523522
},
524-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: schedulerapi.MaxPriority}},
523+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}},
525524
name: "Avoid panic when partial nodes in a topology don't have pods with affinity",
526525
},
527526
}
@@ -594,7 +593,7 @@ func TestHardPodAffinitySymmetricWeight(t *testing.T) {
594593
{ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}},
595594
},
596595
hardPodAffinityWeight: v1.DefaultHardPodAffinitySymmetricWeight,
597-
expectedList: []framework.NodeScore{{Name: "machine1", Score: schedulerapi.MaxPriority}, {Name: "machine2", Score: schedulerapi.MaxPriority}, {Name: "machine3", Score: 0}},
596+
expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}, {Name: "machine3", Score: 0}},
598597
name: "Hard Pod Affinity symmetry: hard pod affinity symmetry weights 1 by default, then nodes that match the hard pod affinity symmetry rules, get a high score",
599598
},
600599
{

0 commit comments

Comments
 (0)