mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #110492 from j2gg0s/opt-var-name-in-hpa
hpa: rename rebalanceIgnored to scaleUpWithUnready for understanding
This commit is contained in:
commit
4cb7524e5a
@ -94,8 +94,8 @@ func (c *ReplicaCalculator) GetResourceReplicas(ctx context.Context, currentRepl
|
|||||||
return 0, 0, 0, time.Time{}, err
|
return 0, 0, 0, time.Time{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rebalanceIgnored := len(unreadyPods) > 0 && usageRatio > 1.0
|
scaleUpWithUnready := len(unreadyPods) > 0 && usageRatio > 1.0
|
||||||
if !rebalanceIgnored && len(missingPods) == 0 {
|
if !scaleUpWithUnready && len(missingPods) == 0 {
|
||||||
if math.Abs(1.0-usageRatio) <= c.tolerance {
|
if math.Abs(1.0-usageRatio) <= c.tolerance {
|
||||||
// return the current replicas if the change would be too small
|
// return the current replicas if the change would be too small
|
||||||
return currentReplicas, utilization, rawUtilization, timestamp, nil
|
return currentReplicas, utilization, rawUtilization, timestamp, nil
|
||||||
@ -119,7 +119,7 @@ func (c *ReplicaCalculator) GetResourceReplicas(ctx context.Context, currentRepl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if rebalanceIgnored {
|
if scaleUpWithUnready {
|
||||||
// on a scale-up, treat unready pods as using 0% of the resource request
|
// on a scale-up, treat unready pods as using 0% of the resource request
|
||||||
for podName := range unreadyPods {
|
for podName := range unreadyPods {
|
||||||
metrics[podName] = metricsclient.PodMetric{Value: 0}
|
metrics[podName] = metricsclient.PodMetric{Value: 0}
|
||||||
@ -196,9 +196,9 @@ func (c *ReplicaCalculator) calcPlainMetricReplicas(metrics metricsclient.PodMet
|
|||||||
|
|
||||||
usageRatio, utilization := metricsclient.GetMetricUtilizationRatio(metrics, targetUtilization)
|
usageRatio, utilization := metricsclient.GetMetricUtilizationRatio(metrics, targetUtilization)
|
||||||
|
|
||||||
rebalanceIgnored := len(unreadyPods) > 0 && usageRatio > 1.0
|
scaleUpWithUnready := len(unreadyPods) > 0 && usageRatio > 1.0
|
||||||
|
|
||||||
if !rebalanceIgnored && len(missingPods) == 0 {
|
if !scaleUpWithUnready && len(missingPods) == 0 {
|
||||||
if math.Abs(1.0-usageRatio) <= c.tolerance {
|
if math.Abs(1.0-usageRatio) <= c.tolerance {
|
||||||
// return the current replicas if the change would be too small
|
// return the current replicas if the change would be too small
|
||||||
return currentReplicas, utilization, nil
|
return currentReplicas, utilization, nil
|
||||||
@ -222,7 +222,7 @@ func (c *ReplicaCalculator) calcPlainMetricReplicas(metrics metricsclient.PodMet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if rebalanceIgnored {
|
if scaleUpWithUnready {
|
||||||
// on a scale-up, treat unready pods as using 0% of the resource request
|
// on a scale-up, treat unready pods as using 0% of the resource request
|
||||||
for podName := range unreadyPods {
|
for podName := range unreadyPods {
|
||||||
metrics[podName] = metricsclient.PodMetric{Value: 0}
|
metrics[podName] = metricsclient.PodMetric{Value: 0}
|
||||||
|
Loading…
Reference in New Issue
Block a user