mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Merge pull request #39279 from andrewsykim/kubectl-get-hpa-show-current-replicas
Automatic merge from submit-queue (batch tested with PRs 35782, 35831, 39279, 40853, 40867) kubectl get hpa should print number of replicas **What this PR does / why we need it**: Prints number of replicas on deployment managed by HPA. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # None, couldn't find one related. **Special notes for your reviewer**: Couldn't find any tests for validating kubectl output for hpa, if there are please point me to them and I will add. **Release note**: ```release-note ```
This commit is contained in:
commit
9721459536
@ -533,7 +533,7 @@ var (
|
||||
|
||||
// TODO: consider having 'KIND' for third party resource data
|
||||
thirdPartyResourceDataColumns = []string{"NAME", "LABELS", "DATA"}
|
||||
horizontalPodAutoscalerColumns = []string{"NAME", "REFERENCE", "TARGET", "CURRENT", "MINPODS", "MAXPODS", "AGE"}
|
||||
horizontalPodAutoscalerColumns = []string{"NAME", "REFERENCE", "TARGET", "CURRENT", "MINPODS", "MAXPODS", "REPLICAS", "AGE"}
|
||||
withNamespacePrefixColumns = []string{"NAMESPACE"} // TODO(erictune): print cluster name too.
|
||||
deploymentColumns = []string{"NAME", "DESIRED", "CURRENT", "UP-TO-DATE", "AVAILABLE", "AGE"}
|
||||
deploymentWideColumns = []string{"CONTAINER(S)", "IMAGE(S)", "SELECTOR"}
|
||||
@ -2165,6 +2165,7 @@ func printHorizontalPodAutoscaler(hpa *autoscaling.HorizontalPodAutoscaler, w io
|
||||
minPods = fmt.Sprintf("%d", *hpa.Spec.MinReplicas)
|
||||
}
|
||||
maxPods := hpa.Spec.MaxReplicas
|
||||
currentReplicas := hpa.Status.CurrentReplicas
|
||||
|
||||
if options.WithNamespace {
|
||||
if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil {
|
||||
@ -2172,13 +2173,14 @@ func printHorizontalPodAutoscaler(hpa *autoscaling.HorizontalPodAutoscaler, w io
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%d\t%s",
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%d\t%d\t%s",
|
||||
name,
|
||||
reference,
|
||||
target,
|
||||
current,
|
||||
minPods,
|
||||
maxPods,
|
||||
currentReplicas,
|
||||
translateTimestamp(hpa.CreationTimestamp),
|
||||
); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user