kubectl get hpa should how current replicas

pull/6/head
andrewsykim 2016-12-24 11:54:13 -05:00
parent 24b3f6c494
commit b8311ec7f9
1 changed files with 4 additions and 2 deletions

View File

@ -507,7 +507,7 @@ var (
// TODO: consider having 'KIND' for third party resource data // TODO: consider having 'KIND' for third party resource data
thirdPartyResourceDataColumns = []string{"NAME", "LABELS", "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. withNamespacePrefixColumns = []string{"NAMESPACE"} // TODO(erictune): print cluster name too.
deploymentColumns = []string{"NAME", "DESIRED", "CURRENT", "UP-TO-DATE", "AVAILABLE", "AGE"} deploymentColumns = []string{"NAME", "DESIRED", "CURRENT", "UP-TO-DATE", "AVAILABLE", "AGE"}
configMapColumns = []string{"NAME", "DATA", "AGE"} configMapColumns = []string{"NAME", "DATA", "AGE"}
@ -2114,6 +2114,7 @@ func printHorizontalPodAutoscaler(hpa *autoscaling.HorizontalPodAutoscaler, w io
minPods = fmt.Sprintf("%d", *hpa.Spec.MinReplicas) minPods = fmt.Sprintf("%d", *hpa.Spec.MinReplicas)
} }
maxPods := hpa.Spec.MaxReplicas maxPods := hpa.Spec.MaxReplicas
currentReplicas := hpa.Status.CurrentReplicas
if options.WithNamespace { if options.WithNamespace {
if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil {
@ -2121,13 +2122,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, name,
reference, reference,
target, target,
current, current,
minPods, minPods,
maxPods, maxPods,
currentReplicas,
translateTimestamp(hpa.CreationTimestamp), translateTimestamp(hpa.CreationTimestamp),
); err != nil { ); err != nil {
return err return err