Skip to content

Commit 99fb416

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#59609 from zhangxiaoyu-zidif/add-rs-in-hpa-describe
Automatic merge from submit-queue (batch tested with PRs 61434, 61501, 59609, 61467, 61531). 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>. Add others's status in hpa describe **What this PR does / why we need it**: Add other status in HPA describe - rs - deployment **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note Add all kinds of resource objects' statuses in HPA description. ```
2 parents dcdf70a + 9bed608 commit 99fb416

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
@@ -2938,17 +2938,9 @@ func describeHorizontalPodAutoscaler(hpa *autoscaling.HorizontalPodAutoscaler, e
29382938
}
29392939
w.Write(LEVEL_0, "Min replicas:\t%s\n", minReplicas)
29402940
w.Write(LEVEL_0, "Max replicas:\t%d\n", hpa.Spec.MaxReplicas)
2941+
w.Write(LEVEL_0, "%s pods:\t", hpa.Spec.ScaleTargetRef.Kind)
2942+
w.Write(LEVEL_0, "%d current / %d desired\n", hpa.Status.CurrentReplicas, hpa.Status.DesiredReplicas)
29412943

2942-
// TODO: switch to scale subresource once the required code is submitted.
2943-
if strings.ToLower(hpa.Spec.ScaleTargetRef.Kind) == "replicationcontroller" {
2944-
w.Write(LEVEL_0, "ReplicationController pods:\t")
2945-
rc, err := d.client.Core().ReplicationControllers(hpa.Namespace).Get(hpa.Spec.ScaleTargetRef.Name, metav1.GetOptions{})
2946-
if err == nil {
2947-
w.Write(LEVEL_0, "%d current / %d desired\n", rc.Status.Replicas, rc.Spec.Replicas)
2948-
} else {
2949-
w.Write(LEVEL_0, "failed to check Replication Controller\n")
2950-
}
2951-
}
29522944
if len(hpa.Status.Conditions) > 0 {
29532945
w.Write(LEVEL_0, "Conditions:\n")
29542946
w.Write(LEVEL_1, "Type\tStatus\tReason\tMessage\n")

0 commit comments

Comments
 (0)