From 83d2f025bedec3d0620cd609d421e126e78ebb30 Mon Sep 17 00:00:00 2001 From: Avesh Agarwal Date: Fri, 11 Aug 2017 13:44:30 -0400 Subject: [PATCH] Implement numberofnodes threshold. --- pkg/rescheduler/strategies/lownodeutilization.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 + } } }