Skip to content

Commit

Permalink
Differentiate between target and target average value
Browse files Browse the repository at this point in the history
  • Loading branch information
bskiba committed Feb 26, 2018
1 parent afe1724 commit d003550
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/printers/internalversion/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pkg/printers/internalversion/printers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/printers/internalversion/printers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit d003550

Please sign in to comment.