mirror of https://github.com/k3s-io/k3s
Run old-style priority functions in parallel to the map-reduce style ones
parent
76591db7d4
commit
ece8f42ea2
|
@ -657,19 +657,21 @@ func PrioritizeNodes(
|
||||||
|
|
||||||
// DEPRECATED: we can remove this when all priorityConfigs implement the
|
// DEPRECATED: we can remove this when all priorityConfigs implement the
|
||||||
// Map-Reduce pattern.
|
// Map-Reduce pattern.
|
||||||
workqueue.ParallelizeUntil(context.TODO(), 16, len(priorityConfigs), func(i int) {
|
for i := range priorityConfigs {
|
||||||
priorityConfig := priorityConfigs[i]
|
if priorityConfigs[i].Function != nil {
|
||||||
if priorityConfig.Function == nil {
|
wg.Add(1)
|
||||||
|
go func(index int) {
|
||||||
|
defer wg.Done()
|
||||||
|
var err error
|
||||||
|
results[index], err = priorityConfigs[index].Function(pod, nodeNameToInfo, nodes)
|
||||||
|
if err != nil {
|
||||||
|
appendError(err)
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
} else {
|
||||||
results[i] = make(schedulerapi.HostPriorityList, len(nodes))
|
results[i] = make(schedulerapi.HostPriorityList, len(nodes))
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var err error
|
|
||||||
results[i], err = priorityConfig.Function(pod, nodeNameToInfo, nodes)
|
|
||||||
if err != nil {
|
|
||||||
appendError(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
workqueue.ParallelizeUntil(context.TODO(), 16, len(nodes), func(index int) {
|
workqueue.ParallelizeUntil(context.TODO(), 16, len(nodes), func(index int) {
|
||||||
nodeInfo := nodeNameToInfo[nodes[index].Name]
|
nodeInfo := nodeNameToInfo[nodes[index].Name]
|
||||||
|
|
Loading…
Reference in New Issue