1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +01:00

Implement numberofnodes threshold.

This commit is contained in:
Avesh Agarwal
2017-08-11 13:44:30 -04:00
parent 49df977a01
commit 83d2f025be

View File

@@ -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
}
}
}