Skip to content

Commit 9bed608

Browse files
author
zhangxiaoyu-zidif
committed
switch to scale subresource when describe hpa replicas
1 parent 3cf94ef commit 9bed608

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

pkg/printers/internalversion/describe.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,17 +2864,9 @@ func describeHorizontalPodAutoscaler(hpa *autoscaling.HorizontalPodAutoscaler, e
28642864
}
28652865
w.Write(LEVEL_0, "Min replicas:\t%s\n", minReplicas)
28662866
w.Write(LEVEL_0, "Max replicas:\t%d\n", hpa.Spec.MaxReplicas)
2867+
w.Write(LEVEL_0, "%s pods:\t", hpa.Spec.ScaleTargetRef.Kind)
2868+
w.Write(LEVEL_0, "%d current / %d desired\n", hpa.Status.CurrentReplicas, hpa.Status.DesiredReplicas)
28672869

2868-
// TODO: switch to scale subresource once the required code is submitted.
2869-
if strings.ToLower(hpa.Spec.ScaleTargetRef.Kind) == "replicationcontroller" {
2870-
w.Write(LEVEL_0, "ReplicationController pods:\t")
2871-
rc, err := d.client.Core().ReplicationControllers(hpa.Namespace).Get(hpa.Spec.ScaleTargetRef.Name, metav1.GetOptions{})
2872-
if err == nil {
2873-
w.Write(LEVEL_0, "%d current / %d desired\n", rc.Status.Replicas, rc.Spec.Replicas)
2874-
} else {
2875-
w.Write(LEVEL_0, "failed to check Replication Controller\n")
2876-
}
2877-
}
28782870
if len(hpa.Status.Conditions) > 0 {
28792871
w.Write(LEVEL_0, "Conditions:\n")
28802872
w.Write(LEVEL_1, "Type\tStatus\tReason\tMessage\n")

0 commit comments

Comments
 (0)