Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1856870

Summary: oc adm top [node|pod] --help is repeating the word "top"
Product: OpenShift Container Platform Reporter: Oscar Casal Sanchez <ocasalsa>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: RamaKasturi <knarra>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: aos-bugs, jokerman, knarra, mfojtik
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:14:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Oscar Casal Sanchez 2020-07-14 15:41:40 UTC
[Description of problem]
When a user enters the command:

$ oc adm top node --help

or 

$ oc adm top pod --help

it is possible to see the word top repeated twice in examples like this:

~~~
$ oc adm top pod --help
...
Examples:
  # Show metrics for all pods in the default namespace
  oc adm top top pod
  
  # Show metrics for all pods in the given namespace
  oc adm top top pod --namespace=NAMESPACE
  
  # Show metrics for a given pod and its containers
  oc adm top top pod POD_NAME --containers
  
  # Show metrics for the pods defined by label name=myLabel
  oc adm top top pod -l name=myLabel
...
~~~

Or like this:

~~~
$ oc adm top node --help
...
Examples:
  # Show metrics for all nodes
  oc adm top top node
  
  # Show metrics for a given node
  oc adm top top node NODE_NAME
...
~~~


[Version-Release number of selected component (if applicable)]

$ oc version
Client Version: 4.4.3
Server Version: 4.3.21
Kubernetes Version: v1.16.2

But it was seen in previous versions 

[How reproducible]
Always

Comment 1 Maciej Szulik 2020-07-15 08:10:44 UTC
This will be fixed with https://github.com/openshift/oc/pull/461

Comment 4 RamaKasturi 2020-08-12 06:50:10 UTC
Verified with the version below and i see that the issue is fixed.

[ramakasturinarra@dhcp35-60 ~]$ oc version
Client Version: 4.6.0-202008120152.p0-ddbae76
Server Version: 4.6.0-0.nightly-2020-08-12-003456
Kubernetes Version: v1.19.0-rc.2+edbf229-dirty


[ramakasturinarra@dhcp35-60 ~]$ oc adm top node --help
Display Resource (CPU/Memory/Storage) usage of nodes.

 The top-node command allows you to see the resource consumption of nodes.

Aliases:
node, nodes, no

Usage:
  oc adm top node [NAME | -l label] [flags]

Examples:
  # Show metrics for all nodes
  oc adm top node
  
  # Show metrics for a given node
  oc adm top node NODE_NAME

Options:
      --no-headers=false: If present, print output without headers
  -l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
      --sort-by='': If non-empty, sort nodes list using specified field. The field can be either 'cpu' or 'memory'.

Use "oc adm options" for a list of global command-line options (applies to all commands).
[ramakasturinarra@dhcp35-60 ~]$ oc adm top pod --help
Display Resource (CPU/Memory/Storage) usage of pods.

 The 'top pod' command allows you to see the resource consumption of pods.

 Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.

Aliases:
pod, pods, po

Usage:
  oc adm top pod [NAME | -l label] [flags]

Examples:
  # Show metrics for all pods in the default namespace
  oc adm top pod
  
  # Show metrics for all pods in the given namespace
  oc adm top pod --namespace=NAMESPACE
  
  # Show metrics for a given pod and its containers
  oc adm top pod POD_NAME --containers
  
  # Show metrics for the pods defined by label name=myLabel
  oc adm top pod -l name=myLabel

Options:
  -A, --all-namespaces=false: If present, list the requested object(s) across all namespaces. Namespace in current
context is ignored even if specified with --namespace.
      --containers=false: If present, print usage of containers within a pod.
      --no-headers=false: If present, print output without headers.
  -l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
      --sort-by='': If non-empty, sort pods list using specified field. The field can be either 'cpu' or 'memory'.

Use "oc adm options" for a list of global command-line options (applies to all commands).

Based on the above moving the bug to verified state.

Comment 6 errata-xmlrpc 2020-10-27 16:14:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196