Skip to content

Commit 0b81f91

Browse files
committed
Fix the issue Iluvatar device scheduling policy binpack and spread are reversed
Signed-off-by: 魏强 <[email protected]>
1 parent 9a034b9 commit 0b81f91

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/device/iluvatar/device.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ func (ilu *IluvatarDevices) Fit(devices []*device.DeviceUsage, request device.Co
283283
var tmpDevs map[string]device.ContainerDevices
284284
tmpDevs = make(map[string]device.ContainerDevices)
285285
reason := make(map[string]int)
286-
for i := range devices {
286+
for i := len(devices) - 1; i >= 0; i-- {
287287
dev := devices[i]
288288
klog.V(4).InfoS("scoring pod", "pod", klog.KObj(pod), "device", dev.ID, "Memreq", k.Memreq, "MemPercentagereq", k.MemPercentagereq, "Coresreq", k.Coresreq, "Nums", k.Nums, "device index", i)
289289

pkg/device/iluvatar/device_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ func Test_Fit(t *testing.T) {
556556
annos: map[string]string{},
557557
wantOK: true,
558558
wantLen: 1,
559-
wantDevIDs: []string{"dev-0"},
559+
wantDevIDs: []string{"dev-1"},
560560
},
561561
{
562562
name: "fit fail: memory not enough",

0 commit comments

Comments
 (0)