Bug 1949820 - Unable to use `oc adm top is` shortcut when asking for `imagestreams`
Summary: Unable to use `oc adm top is` shortcut when asking for `imagestreams`
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.6.z
Hardware: All
OS: All
low
low
Target Milestone: ---
: 4.8.0
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-15 08:02 UTC by Leo Ochoa
Modified: 2021-08-03 20:18 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
If this bug requires documentation, please select an appropriate Doc Type value.
Clone Of:
Environment:
Last Closed: 2021-07-27 23:00:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 810 0 None closed Bug 1949820: Add an alias to imagestreams in top command 2021-04-22 13:20:23 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 23:01:18 UTC

Description Leo Ochoa 2021-04-15 08:02:20 UTC
Description of problem:
From the list of `flags` available via the `oc adm top` command, the `imagestreams` cannot be requested using its alias (`ìs`), as per `no` or `po` when node and pods are requested respectively.

```
$ oc adm top
Show usage statistics of resources on the server
 This command analyzes resources managed by the platform and presents current usage statistics.
Usage:
  oc adm top [flags]
Available Commands:
  images       Show usage statistics for Images
  imagestreams Show usage statistics for ImageStreams
  node         Display Resource (CPU/Memory/Storage) usage of nodes
  pod          Display Resource (CPU/Memory/Storage) usage of pods
Use "oc adm <command> --help" for more information about a given command.
Use "oc adm options" for a list of global command-line options (applies to all commands)
```


Version-Release number of selected component (if applicable):

$ oc version
Client Version: 4.6.1
Kubernetes Version: v1.19.0+d59ce34


This can be corroborated here:
```
$ oc adm top is
error: unknown command "is"
See 'oc adm top -h' for help and examples
```
```
$ oc adm top no
NAME          CPU(cores)       CPU%        MEMORY (bytes)       MEMORY%
master01      2297m            65%         5195Mi               34%
```


The aliases of `imagestreams` and `nodes` can be found here:
```
$ oc api-resources | grep "imagestreams\|nodes"
nodes                                 no                                                     false        Node
imagestreams                          is               image.openshift.io                    true         ImageStream
```


This's implemented in upstream `kubectl` (for `NewCmdTopNode`) as shown here: https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/top/top_node.go#L88

A patch PR can be found here (https://github.com/openshift/oc/pull/810), but it'd need review probably.

Comment 2 zhou ying 2021-04-22 02:09:19 UTC
Can't reproduce with latest oc :

[root@localhost ~]# ./oc adm top is 
NAME                                                          STORAGE  IMAGES LAYERS 
openshift/jboss-datavirt64-openshift                          8.633GiB 8      50     
openshift/fuse7-eap-openshift                                 7.242GiB 9      45   
....


[root@localhost ~]# ./oc version  --client -o yaml 
clientVersion:
  buildDate: "2021-04-21T18:11:19Z"
  compiler: gc
  gitCommit: a5f16de8b05e251fe5195adedd4192c2ca66bbad
  gitTreeState: clean
  gitVersion: 4.8.0-202104211714.p0-a5f16de
  goVersion: go1.16.1
  major: ""
  minor: ""
  platform: linux/amd64
releaseClientVersion: 4.8.0-0.nightly-2021-04-21-201409

Comment 5 errata-xmlrpc 2021-07-27 23:00:57 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 (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), 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/RHSA-2021:2438


Note You need to log in before you can comment on or make changes to this bug.