Merge pull request #56331 from shiywang/fix_indent

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove spaces from kubectl describe hpa

Fixes comment left here: https://github.com/kubernetes/kubernetes/pull/36033#discussion_r108020701

@kubernetes/sig-cli-pr-reviews  @DirectXMan12 

```release-note
remove spaces from kubectl describe hpa
```
This commit is contained in:
Kubernetes Submit Queue 2018-01-16 00:10:26 -08:00 committed by GitHub
commit 1dbb4197c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -1487,20 +1487,20 @@ func formatHPAMetrics(specs []autoscaling.MetricSpec, statuses []autoscaling.Met
if len(statuses) > i && statuses[i].Pods != nil { if len(statuses) > i && statuses[i].Pods != nil {
current = statuses[i].Pods.CurrentAverageValue.String() current = statuses[i].Pods.CurrentAverageValue.String()
} }
list = append(list, fmt.Sprintf("%s / %s", current, spec.Pods.TargetAverageValue.String())) list = append(list, fmt.Sprintf("%s/%s", current, spec.Pods.TargetAverageValue.String()))
case autoscaling.ObjectMetricSourceType: case autoscaling.ObjectMetricSourceType:
current := "<unknown>" current := "<unknown>"
if len(statuses) > i && statuses[i].Object != nil { if len(statuses) > i && statuses[i].Object != nil {
current = statuses[i].Object.CurrentValue.String() current = statuses[i].Object.CurrentValue.String()
} }
list = append(list, fmt.Sprintf("%s / %s", current, spec.Object.TargetValue.String())) list = append(list, fmt.Sprintf("%s/%s", current, spec.Object.TargetValue.String()))
case autoscaling.ResourceMetricSourceType: case autoscaling.ResourceMetricSourceType:
if spec.Resource.TargetAverageValue != nil { if spec.Resource.TargetAverageValue != nil {
current := "<unknown>" current := "<unknown>"
if len(statuses) > i && statuses[i].Resource != nil { if len(statuses) > i && statuses[i].Resource != nil {
current = statuses[i].Resource.CurrentAverageValue.String() current = statuses[i].Resource.CurrentAverageValue.String()
} }
list = append(list, fmt.Sprintf("%s / %s", current, spec.Resource.TargetAverageValue.String())) list = append(list, fmt.Sprintf("%s/%s", current, spec.Resource.TargetAverageValue.String()))
} else { } else {
current := "<unknown>" current := "<unknown>"
if len(statuses) > i && statuses[i].Resource != nil && statuses[i].Resource.CurrentAverageUtilization != nil { if len(statuses) > i && statuses[i].Resource != nil && statuses[i].Resource.CurrentAverageUtilization != nil {
@ -1511,7 +1511,7 @@ func formatHPAMetrics(specs []autoscaling.MetricSpec, statuses []autoscaling.Met
if spec.Resource.TargetAverageUtilization != nil { if spec.Resource.TargetAverageUtilization != nil {
target = fmt.Sprintf("%d%%", *spec.Resource.TargetAverageUtilization) target = fmt.Sprintf("%d%%", *spec.Resource.TargetAverageUtilization)
} }
list = append(list, fmt.Sprintf("%s / %s", current, target)) list = append(list, fmt.Sprintf("%s/%s", current, target))
} }
default: default:
list = append(list, "<unknown type>") list = append(list, "<unknown type>")

View File

@ -2194,7 +2194,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5, DesiredReplicas: 5,
}, },
}, },
"some-hpa\tReplicationController/some-rc\t<unknown> / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t<unknown>/100m\t2\t10\t4\t<unknown>\n",
}, },
// pods source type // pods source type
{ {
@ -2231,7 +2231,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\t2\t10\t4\t<unknown>\n",
}, },
// object source type (no current) // object source type (no current)
{ {
@ -2263,7 +2263,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5, DesiredReplicas: 5,
}, },
}, },
"some-hpa\tReplicationController/some-rc\t<unknown> / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t<unknown>/100m\t2\t10\t4\t<unknown>\n",
}, },
// object source type // object source type
{ {
@ -2308,7 +2308,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\t2\t10\t4\t<unknown>\n",
}, },
// resource source type, targetVal (no current) // resource source type, targetVal (no current)
{ {
@ -2336,7 +2336,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5, DesiredReplicas: 5,
}, },
}, },
"some-hpa\tReplicationController/some-rc\t<unknown> / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t<unknown>/100m\t2\t10\t4\t<unknown>\n",
}, },
// resource source type, targetVal // resource source type, targetVal
{ {
@ -2373,7 +2373,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\t2\t10\t4\t<unknown>\n",
}, },
// resource source type, targetUtil (no current) // resource source type, targetUtil (no current)
{ {
@ -2401,7 +2401,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5, DesiredReplicas: 5,
}, },
}, },
"some-hpa\tReplicationController/some-rc\t<unknown> / 80%\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t<unknown>/80%\t2\t10\t4\t<unknown>\n",
}, },
// resource source type, targetUtil // resource source type, targetUtil
{ {
@ -2439,7 +2439,7 @@ func TestPrintHPA(t *testing.T) {
}, },
}, },
}, },
"some-hpa\tReplicationController/some-rc\t50% / 80%\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t50%/80%\t2\t10\t4\t<unknown>\n",
}, },
// multiple specs // multiple specs
{ {
@ -2498,7 +2498,7 @@ func TestPrintHPA(t *testing.T) {
}, },
}, },
}, },
"some-hpa\tReplicationController/some-rc\t50m / 100m, 50% / 80% + 1 more...\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t50m/100m, 50%/80% + 1 more...\t2\t10\t4\t<unknown>\n",
}, },
} }