diff --git a/pkg/rescheduler/strategies/lownodeutilization.go b/pkg/rescheduler/strategies/lownodeutilization.go index 0ab551575..85309650e 100644 --- a/pkg/rescheduler/strategies/lownodeutilization.go +++ b/pkg/rescheduler/strategies/lownodeutilization.go @@ -32,7 +32,6 @@ type NodeUsageMap map[*v1.Node]api.ResourceThresholds func LowNodeUtilization(client clientset.Interface, strategy api.ReschedulerStrategy, evictionPolicyGroupVersion string, nodes []*v1.Node) { lowNodes, otherNodes := []*v1.Node{}, []*v1.Node{} - if strategy.Enabled { thresholds := strategy.Params.NodeResourceUtilizationThresholds.Thresholds if thresholds != nil { @@ -40,7 +39,6 @@ func LowNodeUtilization(client clientset.Interface, strategy api.ReschedulerStra for _, node := range nodes { nodeUsageMap[node] = NodeUtilization(client, node) fmt.Printf("Node %#v usage: %#v\n", node.Name, nodeUsageMap[node]) - if IsNodeWithLowUtilization(nodeUsageMap[node], thresholds) { lowNodes = append(lowNodes, node) } else { @@ -48,6 +46,9 @@ func LowNodeUtilization(client clientset.Interface, strategy api.ReschedulerStra } } } + if len(lowNodes) < strategy.Params.NodeResourceUtilizationThresholds.NumberOfNodes { + return + } } }