mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-28 06:29:29 +01:00
Log and README optimization for LowNodeUtilization
This commit is contained in:
@@ -176,7 +176,9 @@ the node is considered over utilized. Any node between the thresholds, `threshol
|
|||||||
considered appropriately utilized and is not considered for eviction. The threshold, `targetThresholds`,
|
considered appropriately utilized and is not considered for eviction. The threshold, `targetThresholds`,
|
||||||
can be configured for cpu, memory, and number of pods too in terms of percentage.
|
can be configured for cpu, memory, and number of pods too in terms of percentage.
|
||||||
|
|
||||||
These thresholds, `thresholds` and `targetThresholds`, could be tuned as per your cluster requirements.
|
These thresholds, `thresholds` and `targetThresholds`, could be tuned as per your cluster requirements. Note that this
|
||||||
|
strategy evicts pods from `overutilized nodes` (those with usage above `targetThresholds`) to `underutilized nodes`
|
||||||
|
(those with usage below `thresholds`), it will abort if any number of `underutilized nodes` or `overutilized nodes` is zero.
|
||||||
|
|
||||||
**Parameters:**
|
**Parameters:**
|
||||||
|
|
||||||
|
|||||||
@@ -115,32 +115,24 @@ func LowNodeUtilization(ctx context.Context, client clientset.Interface, strateg
|
|||||||
|
|
||||||
klog.V(1).InfoS("Criteria for a node under utilization",
|
klog.V(1).InfoS("Criteria for a node under utilization",
|
||||||
"CPU", thresholds[v1.ResourceCPU], "Mem", thresholds[v1.ResourceMemory], "Pods", thresholds[v1.ResourcePods])
|
"CPU", thresholds[v1.ResourceCPU], "Mem", thresholds[v1.ResourceMemory], "Pods", thresholds[v1.ResourcePods])
|
||||||
|
klog.V(1).InfoS("Number of underutilized nodes", "totalNumber", len(lowNodes))
|
||||||
|
klog.V(1).InfoS("Criteria for a node above target utilization",
|
||||||
|
"CPU", targetThresholds[v1.ResourceCPU], "Mem", targetThresholds[v1.ResourceMemory], "Pods", targetThresholds[v1.ResourcePods])
|
||||||
|
klog.V(1).InfoS("Number of overutilized nodes", "totalNumber", len(targetNodes))
|
||||||
|
|
||||||
if len(lowNodes) == 0 {
|
if len(lowNodes) == 0 {
|
||||||
klog.V(1).InfoS("No node is underutilized, nothing to do here, you might tune your thresholds further")
|
klog.V(1).InfoS("No node is underutilized, nothing to do here, you might tune your thresholds further")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
klog.V(1).InfoS("Total number of underutilized nodes", "totalNumber", len(lowNodes))
|
|
||||||
|
|
||||||
if len(lowNodes) < strategy.Params.NodeResourceUtilizationThresholds.NumberOfNodes {
|
if len(lowNodes) < strategy.Params.NodeResourceUtilizationThresholds.NumberOfNodes {
|
||||||
klog.V(1).InfoS("Number of nodes underutilized is less than NumberOfNodes, nothing to do here", "underutilizedNodes", len(lowNodes), "numberOfNodes", strategy.Params.NodeResourceUtilizationThresholds.NumberOfNodes)
|
klog.V(1).InfoS("Number of nodes underutilized is less than NumberOfNodes, nothing to do here", "underutilizedNodes", len(lowNodes), "numberOfNodes", strategy.Params.NodeResourceUtilizationThresholds.NumberOfNodes)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(lowNodes) == len(nodes) {
|
|
||||||
klog.V(1).InfoS("All nodes are underutilized, nothing to do here")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(targetNodes) == 0 {
|
if len(targetNodes) == 0 {
|
||||||
klog.V(1).InfoS("All nodes are under target utilization, nothing to do here")
|
klog.V(1).InfoS("No node is overutilized, nothing to do here, you might tune your thresholds further")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
klog.V(1).InfoS("Criteria for a node above target utilization",
|
|
||||||
"CPU", targetThresholds[v1.ResourceCPU], "Mem", targetThresholds[v1.ResourceMemory], "Pods", targetThresholds[v1.ResourcePods])
|
|
||||||
|
|
||||||
klog.V(1).InfoS("Number of nodes above target utilization", "totalNumber", len(targetNodes))
|
|
||||||
evictable := podEvictor.Evictable(evictions.WithPriorityThreshold(thresholdPriority))
|
evictable := podEvictor.Evictable(evictions.WithPriorityThreshold(thresholdPriority))
|
||||||
|
|
||||||
evictPodsFromTargetNodes(
|
evictPodsFromTargetNodes(
|
||||||
|
|||||||
Reference in New Issue
Block a user