Skip to content

Commit

Permalink
descheduler: change the order of check len(lowNodes) and len(sourceNo…
Browse files Browse the repository at this point in the history
…des) (#1957)

Signed-off-by: bogo <bogo.ysh@gmail.com>
  • Loading branch information
bogo-y committed Mar 19, 2024
1 parent f3bc42a commit 7540b72
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/descheduler/framework/plugins/loadaware/low_node_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ func (pl *LowNodeLoad) processOneNodePool(ctx context.Context, nodePool *desched

logUtilizationCriteria(nodePool.Name, "Criteria for nodes under low thresholds and above high thresholds", lowThresholds, highThresholds, len(lowNodes), len(sourceNodes), len(nodes))

if len(sourceNodes) == 0 {
klog.V(4).InfoS("All nodes are under target utilization, nothing to do here", "nodePool", nodePool.Name)
return nil
}

abnormalNodes := filterRealAbnormalNodes(sourceNodes, pl.nodeAnomalyDetectors, nodePool.AnomalyCondition)
if len(abnormalNodes) == 0 {
klog.V(4).InfoS("None of the nodes were detected as anomalous, nothing to do here", "nodePool", nodePool.Name)
return nil
}

if len(lowNodes) == 0 {
klog.V(4).InfoS("No nodes are underutilized, nothing to do here, you might tune your thresholds further", "nodePool", nodePool.Name)
return nil
Expand All @@ -188,17 +199,6 @@ func (pl *LowNodeLoad) processOneNodePool(ctx context.Context, nodePool *desched
return nil
}

if len(sourceNodes) == 0 {
klog.V(4).InfoS("All nodes are under target utilization, nothing to do here", "nodePool", nodePool.Name)
return nil
}

abnormalNodes := filterRealAbnormalNodes(sourceNodes, pl.nodeAnomalyDetectors, nodePool.AnomalyCondition)
if len(abnormalNodes) == 0 {
klog.V(4).InfoS("None of the nodes were detected as anomalous, nothing to do here", "nodePool", nodePool.Name)
return nil
}

continueEvictionCond := func(nodeInfo NodeInfo, totalAvailableUsages map[corev1.ResourceName]*resource.Quantity) bool {
if _, overutilized := isNodeOverutilized(nodeInfo.NodeUsage.usage, nodeInfo.thresholds.highResourceThreshold); !overutilized {
resetNodesAsNormal([]NodeInfo{nodeInfo}, pl.nodeAnomalyDetectors)
Expand Down

0 comments on commit 7540b72

Please sign in to comment.