mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +01:00
Implement numberofnodes threshold.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user