mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-23 01:45:12 +00:00
add flag --no-headers to kubectl top ...
This commit is contained in:
@@ -40,6 +40,7 @@ import (
|
||||
type TopNodeOptions struct {
|
||||
ResourceName string
|
||||
Selector string
|
||||
NoHeaders bool
|
||||
NodeClient corev1client.CoreV1Interface
|
||||
HeapsterOptions HeapsterTopOptions
|
||||
Client *metricsutil.HeapsterMetricsClient
|
||||
@@ -118,6 +119,8 @@ func NewCmdTopNode(f cmdutil.Factory, o *TopNodeOptions, streams genericclioptio
|
||||
Aliases: []string{"nodes", "no"},
|
||||
}
|
||||
cmd.Flags().StringVarP(&o.Selector, "selector", "l", o.Selector, "Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
|
||||
cmd.Flags().BoolVar(&o.NoHeaders, "no-headers", o.NoHeaders, "If present, print output without headers")
|
||||
|
||||
o.HeapsterOptions.Bind(cmd.Flags())
|
||||
return cmd
|
||||
}
|
||||
@@ -216,7 +219,7 @@ func (o TopNodeOptions) RunTopNode() error {
|
||||
allocatable[n.Name] = n.Status.Allocatable
|
||||
}
|
||||
|
||||
return o.Printer.PrintNodeMetrics(metrics.Items, allocatable)
|
||||
return o.Printer.PrintNodeMetrics(metrics.Items, allocatable, o.NoHeaders)
|
||||
}
|
||||
|
||||
func getNodeMetricsFromMetricsAPI(metricsClient metricsclientset.Interface, resourceName string, selector labels.Selector) (*metricsapi.NodeMetricsList, error) {
|
||||
|
||||
Reference in New Issue
Block a user