mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-03 02:07:38 +00:00
Differentiate between target and target average value
This commit is contained in:
@@ -2830,13 +2830,13 @@ func describeHorizontalPodAutoscaler(hpa *autoscaling.HorizontalPodAutoscaler, e
|
||||
hpa.Status.CurrentMetrics[i].External.CurrentAverageValue != nil {
|
||||
current = hpa.Status.CurrentMetrics[i].External.CurrentAverageValue.String()
|
||||
}
|
||||
w.Write(LEVEL_1, "%q:\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetAverageValue.String())
|
||||
w.Write(LEVEL_1, "%q (target average value):\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetAverageValue.String())
|
||||
} else {
|
||||
current := "<unknown>"
|
||||
if len(hpa.Status.CurrentMetrics) > i && hpa.Status.CurrentMetrics[i].External != nil {
|
||||
current = hpa.Status.CurrentMetrics[i].External.CurrentValue.String()
|
||||
}
|
||||
w.Write(LEVEL_1, "%q:\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetValue.String())
|
||||
w.Write(LEVEL_1, "%q (target value):\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetValue.String())
|
||||
|
||||
}
|
||||
case autoscaling.PodsMetricSourceType:
|
||||
|
@@ -1497,7 +1497,7 @@ func formatHPAMetrics(specs []autoscaling.MetricSpec, statuses []autoscaling.Met
|
||||
if len(statuses) > i && statuses[i].External != nil && statuses[i].External.CurrentAverageValue != nil {
|
||||
current = statuses[i].External.CurrentAverageValue.String()
|
||||
}
|
||||
list = append(list, fmt.Sprintf("%s/%s", current, spec.External.TargetAverageValue.String()))
|
||||
list = append(list, fmt.Sprintf("%s/%s (avg)", current, spec.External.TargetAverageValue.String()))
|
||||
} else {
|
||||
current := "<unknown>"
|
||||
if len(statuses) > i && statuses[i].External != nil {
|
||||
|
@@ -2200,7 +2200,7 @@ func TestPrintHPA(t *testing.T) {
|
||||
DesiredReplicas: 5,
|
||||
},
|
||||
},
|
||||
"some-hpa\tReplicationController/some-rc\t<unknown>/100m\t2\t10\t4\t<unknown>\n",
|
||||
"some-hpa\tReplicationController/some-rc\t<unknown>/100m (avg)\t2\t10\t4\t<unknown>\n",
|
||||
},
|
||||
// external source type, target average value
|
||||
{
|
||||
@@ -2247,7 +2247,7 @@ func TestPrintHPA(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
"some-hpa\tReplicationController/some-rc\t50m/100m\t2\t10\t4\t<unknown>\n",
|
||||
"some-hpa\tReplicationController/some-rc\t50m/100m (avg)\t2\t10\t4\t<unknown>\n",
|
||||
},
|
||||
// external source type, target value (no current)
|
||||
{
|
||||
|
Reference in New Issue
Block a user