Bug 1878956 - `oc api-resources` does not include API version
Summary: `oc api-resources` does not include API version
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.5
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: 4.7.0
Assignee: Sally
QA Contact: RamaKasturi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-15 03:53 UTC by Jason Boxman
Modified: 2021-02-24 15:18 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-24 15:17:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:5633 0 None None None 2021-02-24 15:18:22 UTC

Description Jason Boxman 2020-09-15 03:53:19 UTC
Description of problem:

When running `oc api-resources`, the version of the API is not included. This presents a challenge when an API with the same name exists in multiple groups, such as Network.config and Network.operator, and I want to then run `oc explain` on an API.

If I don't know the API version, I cannot use `oc explain` for both APIs.


How reproducible:

Always.


Steps to Reproduce:
1. `oc api-resources`


Actual results:

The API version is not included in the output.


Expected results:

The API version is included, so that it's possible to run `oc explain <API> --api-version=<group/version>` for names that exist in more than one API group. By default I don't see anyway to determine the API version other than `oc api-resources -v=9` and looking at the API endpoints queried.


Additional info:

When using -v=9, I see that `oc` already queries each API endpoint, so the API version is already known, it just isn't included in the terminal output.

Comment 1 Sally 2020-10-01 19:42:50 UTC
Looking into adding the API version this sprint, added UpcomingSprint label accordingly

Comment 2 Michal Fojtik 2020-10-15 04:12:06 UTC
This bug hasn't had any activity in the last 30 days. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're marking this bug as "LifecycleStale" and decreasing the severity/priority. If you have further information on the current state of the bug, please update it, otherwise this bug can be closed in about 7 days. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. Additionally, you can add LifecycleFrozen into Keywords if you think this bug should never be marked as stale. Please consult with bug assignee before you do that.

Comment 3 Jason Boxman 2020-10-20 22:51:17 UTC
This is still present in the latest `oc`:

```
% oc api-resources | head

NAME                                  SHORTNAMES       APIGROUP                              NAMESPACED   KIND
bindings                                                                                     true         Binding
componentstatuses                     cs                                                     false        ComponentStatus
configmaps                            cm                                                     true         ConfigMap
endpoints                             ep                                                     true         Endpoints
events                                ev                                                     true         Event
limitranges                           limits                                                 true         LimitRange
namespaces                            ns                                                     false        Namespace
nodes                                 no                                                     false        Node
persistentvolumeclaims                pvc                                                    true         PersistentVolumeClaim

% oc version
Client Version: 4.5.15
Server Version: 4.6.0-rc.4
Kubernetes Version: v1.19.0+d59ce34
```

Comment 4 Michal Fojtik 2020-10-20 23:12:13 UTC
The LifecycleStale keyword was removed because the bug got commented on recently.
The bug assignee was notified.

Comment 5 Sally 2020-10-23 17:12:51 UTC
This was fixed upstream with https://github.com/kubernetes/kubernetes/pull/95253  - it will be pulled in with the next kubernetes-kubectl bump, kube 1.20.  Tracking with upcoming sprint.

Comment 6 Sally 2020-11-12 17:38:31 UTC
Waiting for the upstream fix to land in oc, it will be pulled in with kubernetes-kubectl bump, kube 1.20.  Adding UpcomingSprint.

Comment 7 Michal Fojtik 2020-11-22 18:12:11 UTC
This bug hasn't had any activity in the last 30 days. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're marking this bug as "LifecycleStale" and decreasing the severity/priority. If you have further information on the current state of the bug, please update it, otherwise this bug can be closed in about 7 days. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. Additionally, you can add LifecycleFrozen into Keywords if you think this bug should never be marked as stale. Please consult with bug assignee before you do that.

Comment 8 Jason Boxman 2020-11-25 01:10:33 UTC
So this was merged upstream; I look forward to seeing this in OCP. It'll probably be useful to include in the release notes, but if this is closed as stale, that won't happen.

Comment 9 Sally 2020-12-05 00:36:17 UTC
Finally being vendored into oc now, with kube 1.20, adding UpcomingSprint to track this.

Comment 10 Michal Fojtik 2020-12-25 01:58:21 UTC
This bug hasn't had any activity in the last 30 days. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're marking this bug as "LifecycleStale" and decreasing the severity/priority. If you have further information on the current state of the bug, please update it, otherwise this bug can be closed in about 7 days. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. Additionally, you can add LifecycleFrozen into Keywords if you think this bug should never be marked as stale. Please consult with bug assignee before you do that.

Comment 11 Jason Boxman 2020-12-26 20:25:46 UTC
bump.

Comment 12 Sally 2021-01-04 20:55:24 UTC
moving to modified, please confirm/verify this bug, looks like the change has landed in oc, thanks.

Comment 14 RamaKasturi 2021-01-05 12:32:54 UTC
Verified bug with oc client version below and i see that APIVERSION is present.

[knarra@knarra verification-tests]$ oc version -o yaml
clientVersion:
  buildDate: "2020-12-22T02:22:23Z"
  compiler: gc
  gitCommit: 8fbc95fdb0e31194797127fd79b891857fed36ac
  gitTreeState: clean
  gitVersion: 4.7.0-202012220147.p0-8fbc95f
  goVersion: go1.15.5
  major: ""
  minor: ""
  platform: linux/amd64
openshiftVersion: 4.7.0-0.nightly-2020-12-21-131655
serverVersion:
  buildDate: "2020-12-15T09:58:43Z"
  compiler: gc
  gitCommit: 87544c5b79d20e7ea1f973dec6910870d2c2a08a
  gitTreeState: clean
  gitVersion: v1.20.0+87544c5
  goVersion: go1.15.5
  major: "1"
  minor: "20"
  platform: linux/amd64

[knarra@knarra verification-tests]$ oc api-resources | head
NAME                                  SHORTNAMES       APIVERSION                                    NAMESPACED   KIND
bindings                                               v1                                            true         Binding
componentstatuses                     cs               v1                                            false        ComponentStatus
configmaps                            cm               v1                                            true         ConfigMap
endpoints                             ep               v1                                            true         Endpoints
events                                ev               v1                                            true         Event
limitranges                           limits           v1                                            true         LimitRange
namespaces                            ns               v1                                            false        Namespace
nodes                                 no               v1                                            false        Node
persistentvolumeclaims                pvc              v1                                            true         PersistentVolumeClaim

Full list:
===========================
[knarra@knarra verification-tests]$ oc api-resources
NAME                                  SHORTNAMES       APIVERSION                                    NAMESPACED   KIND
bindings                                               v1                                            true         Binding
componentstatuses                     cs               v1                                            false        ComponentStatus
configmaps                            cm               v1                                            true         ConfigMap
endpoints                             ep               v1                                            true         Endpoints
events                                ev               v1                                            true         Event
limitranges                           limits           v1                                            true         LimitRange
namespaces                            ns               v1                                            false        Namespace
nodes                                 no               v1                                            false        Node
persistentvolumeclaims                pvc              v1                                            true         PersistentVolumeClaim
persistentvolumes                     pv               v1                                            false        PersistentVolume
pods                                  po               v1                                            true         Pod
podtemplates                                           v1                                            true         PodTemplate
replicationcontrollers                rc               v1                                            true         ReplicationController
resourcequotas                        quota            v1                                            true         ResourceQuota
secrets                                                v1                                            true         Secret
serviceaccounts                       sa               v1                                            true         ServiceAccount
services                              svc              v1                                            true         Service
mutatingwebhookconfigurations                          admissionregistration.k8s.io/v1               false        MutatingWebhookConfiguration
validatingwebhookconfigurations                        admissionregistration.k8s.io/v1               false        ValidatingWebhookConfiguration
customresourcedefinitions             crd,crds         apiextensions.k8s.io/v1                       false        CustomResourceDefinition
apiservices                                            apiregistration.k8s.io/v1                     false        APIService
controllerrevisions                                    apps/v1                                       true         ControllerRevision
daemonsets                            ds               apps/v1                                       true         DaemonSet
deployments                           deploy           apps/v1                                       true         Deployment
replicasets                           rs               apps/v1                                       true         ReplicaSet
statefulsets                          sts              apps/v1                                       true         StatefulSet
deploymentconfigs                     dc               apps.openshift.io/v1                          true         DeploymentConfig
tokenreviews                                           authentication.k8s.io/v1                      false        TokenReview
localsubjectaccessreviews                              authorization.k8s.io/v1                       true         LocalSubjectAccessReview
selfsubjectaccessreviews                               authorization.k8s.io/v1                       false        SelfSubjectAccessReview
selfsubjectrulesreviews                                authorization.k8s.io/v1                       false        SelfSubjectRulesReview
subjectaccessreviews                                   authorization.k8s.io/v1                       false        SubjectAccessReview
clusterrolebindings                                    authorization.openshift.io/v1                 false        ClusterRoleBinding
clusterroles                                           authorization.openshift.io/v1                 false        ClusterRole
localresourceaccessreviews                             authorization.openshift.io/v1                 true         LocalResourceAccessReview
localsubjectaccessreviews                              authorization.openshift.io/v1                 true         LocalSubjectAccessReview
resourceaccessreviews                                  authorization.openshift.io/v1                 false        ResourceAccessReview
rolebindingrestrictions                                authorization.openshift.io/v1                 true         RoleBindingRestriction
rolebindings                                           authorization.openshift.io/v1                 true         RoleBinding
roles                                                  authorization.openshift.io/v1                 true         Role
selfsubjectrulesreviews                                authorization.openshift.io/v1                 true         SelfSubjectRulesReview
subjectaccessreviews                                   authorization.openshift.io/v1                 false        SubjectAccessReview
subjectrulesreviews                                    authorization.openshift.io/v1                 true         SubjectRulesReview
horizontalpodautoscalers              hpa              autoscaling/v1                                true         HorizontalPodAutoscaler
clusterautoscalers                    ca               autoscaling.openshift.io/v1                   false        ClusterAutoscaler
machineautoscalers                    ma               autoscaling.openshift.io/v1beta1              true         MachineAutoscaler
cronjobs                              cj               batch/v1beta1                                 true         CronJob
jobs                                                   batch/v1                                      true         Job
buildconfigs                          bc               build.openshift.io/v1                         true         BuildConfig
builds                                                 build.openshift.io/v1                         true         Build
certificatesigningrequests            csr              certificates.k8s.io/v1                        false        CertificateSigningRequest
credentialsrequests                                    cloudcredential.openshift.io/v1               true         CredentialsRequest
apiservers                                             config.openshift.io/v1                        false        APIServer
authentications                                        config.openshift.io/v1                        false        Authentication
builds                                                 config.openshift.io/v1                        false        Build
clusteroperators                      co               config.openshift.io/v1                        false        ClusterOperator
clusterversions                                        config.openshift.io/v1                        false        ClusterVersion
consoles                                               config.openshift.io/v1                        false        Console
dnses                                                  config.openshift.io/v1                        false        DNS
featuregates                                           config.openshift.io/v1                        false        FeatureGate
images                                                 config.openshift.io/v1                        false        Image
infrastructures                                        config.openshift.io/v1                        false        Infrastructure
ingresses                                              config.openshift.io/v1                        false        Ingress
networks                                               config.openshift.io/v1                        false        Network
oauths                                                 config.openshift.io/v1                        false        OAuth
operatorhubs                                           config.openshift.io/v1                        false        OperatorHub
projects                                               config.openshift.io/v1                        false        Project
proxies                                                config.openshift.io/v1                        false        Proxy
schedulers                                             config.openshift.io/v1                        false        Scheduler
consoleclidownloads                                    console.openshift.io/v1                       false        ConsoleCLIDownload
consoleexternalloglinks                                console.openshift.io/v1                       false        ConsoleExternalLogLink
consolelinks                                           console.openshift.io/v1                       false        ConsoleLink
consolenotifications                                   console.openshift.io/v1                       false        ConsoleNotification
consolequickstarts                                     console.openshift.io/v1                       false        ConsoleQuickStart
consoleyamlsamples                                     console.openshift.io/v1                       false        ConsoleYAMLSample
podnetworkconnectivitychecks                           controlplane.operator.openshift.io/v1alpha1   true         PodNetworkConnectivityCheck
leases                                                 coordination.k8s.io/v1                        true         Lease
endpointslices                                         discovery.k8s.io/v1beta1                      true         EndpointSlice
events                                ev               events.k8s.io/v1                              true         Event
ingresses                             ing              extensions/v1beta1                            true         Ingress
flowschemas                                            flowcontrol.apiserver.k8s.io/v1beta1          false        FlowSchema
prioritylevelconfigurations                            flowcontrol.apiserver.k8s.io/v1beta1          false        PriorityLevelConfiguration
helmchartrepositories                                  helm.openshift.io/v1beta1                     false        HelmChartRepository
images                                                 image.openshift.io/v1                         false        Image
imagesignatures                                        image.openshift.io/v1                         false        ImageSignature
imagestreamimages                     isimage          image.openshift.io/v1                         true         ImageStreamImage
imagestreamimports                                     image.openshift.io/v1                         true         ImageStreamImport
imagestreammappings                                    image.openshift.io/v1                         true         ImageStreamMapping
imagestreams                          is               image.openshift.io/v1                         true         ImageStream
imagestreamtags                       istag            image.openshift.io/v1                         true         ImageStreamTag
imagetags                             itag             image.openshift.io/v1                         true         ImageTag
configs                                                imageregistry.operator.openshift.io/v1        false        Config
imagepruners                                           imageregistry.operator.openshift.io/v1        false        ImagePruner
dnsrecords                                             ingress.operator.openshift.io/v1              true         DNSRecord
network-attachment-definitions        net-attach-def   k8s.cni.cncf.io/v1                            true         NetworkAttachmentDefinition
machinehealthchecks                   mhc,mhcs         machine.openshift.io/v1beta1                  true         MachineHealthCheck
machines                                               machine.openshift.io/v1beta1                  true         Machine
machinesets                                            machine.openshift.io/v1beta1                  true         MachineSet
containerruntimeconfigs               ctrcfg           machineconfiguration.openshift.io/v1          false        ContainerRuntimeConfig
controllerconfigs                                      machineconfiguration.openshift.io/v1          false        ControllerConfig
kubeletconfigs                                         machineconfiguration.openshift.io/v1          false        KubeletConfig
machineconfigpools                    mcp              machineconfiguration.openshift.io/v1          false        MachineConfigPool
machineconfigs                        mc               machineconfiguration.openshift.io/v1          false        MachineConfig
baremetalhosts                        bmh,bmhost       metal3.io/v1alpha1                            true         BareMetalHost
provisionings                                          metal3.io/v1alpha1                            false        Provisioning
nodes                                                  metrics.k8s.io/v1beta1                        false        NodeMetrics
pods                                                   metrics.k8s.io/v1beta1                        true         PodMetrics
storagestates                                          migration.k8s.io/v1alpha1                     false        StorageState
storageversionmigrations                               migration.k8s.io/v1alpha1                     false        StorageVersionMigration
alertmanagerconfigs                                    monitoring.coreos.com/v1alpha1                true         AlertmanagerConfig
alertmanagers                                          monitoring.coreos.com/v1                      true         Alertmanager
podmonitors                                            monitoring.coreos.com/v1                      true         PodMonitor
probes                                                 monitoring.coreos.com/v1                      true         Probe
prometheuses                                           monitoring.coreos.com/v1                      true         Prometheus
prometheusrules                                        monitoring.coreos.com/v1                      true         PrometheusRule
servicemonitors                                        monitoring.coreos.com/v1                      true         ServiceMonitor
thanosrulers                                           monitoring.coreos.com/v1                      true         ThanosRuler
clusternetworks                                        network.openshift.io/v1                       false        ClusterNetwork
egressnetworkpolicies                                  network.openshift.io/v1                       true         EgressNetworkPolicy
hostsubnets                                            network.openshift.io/v1                       false        HostSubnet
netnamespaces                                          network.openshift.io/v1                       false        NetNamespace
operatorpkis                                           network.operator.openshift.io/v1              true         OperatorPKI
ingressclasses                                         networking.k8s.io/v1                          false        IngressClass
ingresses                             ing              networking.k8s.io/v1                          true         Ingress
networkpolicies                       netpol           networking.k8s.io/v1                          true         NetworkPolicy
runtimeclasses                                         node.k8s.io/v1                                false        RuntimeClass
oauthaccesstokens                                      oauth.openshift.io/v1                         false        OAuthAccessToken
oauthauthorizetokens                                   oauth.openshift.io/v1                         false        OAuthAuthorizeToken
oauthclientauthorizations                              oauth.openshift.io/v1                         false        OAuthClientAuthorization
oauthclients                                           oauth.openshift.io/v1                         false        OAuthClient
useroauthaccesstokens                                  oauth.openshift.io/v1                         false        UserOAuthAccessToken
authentications                                        operator.openshift.io/v1                      false        Authentication
cloudcredentials                                       operator.openshift.io/v1                      false        CloudCredential
clustercsidrivers                                      operator.openshift.io/v1                      false        ClusterCSIDriver
configs                                                operator.openshift.io/v1                      false        Config
consoles                                               operator.openshift.io/v1                      false        Console
csisnapshotcontrollers                                 operator.openshift.io/v1                      false        CSISnapshotController
dnses                                                  operator.openshift.io/v1                      false        DNS
etcds                                                  operator.openshift.io/v1                      false        Etcd
imagecontentsourcepolicies                             operator.openshift.io/v1alpha1                false        ImageContentSourcePolicy
ingresscontrollers                                     operator.openshift.io/v1                      true         IngressController
kubeapiservers                                         operator.openshift.io/v1                      false        KubeAPIServer
kubecontrollermanagers                                 operator.openshift.io/v1                      false        KubeControllerManager
kubeschedulers                                         operator.openshift.io/v1                      false        KubeScheduler
kubestorageversionmigrators                            operator.openshift.io/v1                      false        KubeStorageVersionMigrator
networks                                               operator.openshift.io/v1                      false        Network
openshiftapiservers                                    operator.openshift.io/v1                      false        OpenShiftAPIServer
openshiftcontrollermanagers                            operator.openshift.io/v1                      false        OpenShiftControllerManager
servicecas                                             operator.openshift.io/v1                      false        ServiceCA
storages                                               operator.openshift.io/v1                      false        Storage
catalogsources                        catsrc           operators.coreos.com/v1alpha1                 true         CatalogSource
clusterserviceversions                csv,csvs         operators.coreos.com/v1alpha1                 true         ClusterServiceVersion
installplans                          ip               operators.coreos.com/v1alpha1                 true         InstallPlan
operatorconditions                                     operators.coreos.com/v1                       true         OperatorCondition
operatorgroups                        og               operators.coreos.com/v1                       true         OperatorGroup
operators                                              operators.coreos.com/v1                       false        Operator
subscriptions                         sub,subs         operators.coreos.com/v1alpha1                 true         Subscription
packagemanifests                                       packages.operators.coreos.com/v1              true         PackageManifest
poddisruptionbudgets                  pdb              policy/v1beta1                                true         PodDisruptionBudget
podsecuritypolicies                   psp              policy/v1beta1                                false        PodSecurityPolicy
projectrequests                                        project.openshift.io/v1                       false        ProjectRequest
projects                                               project.openshift.io/v1                       false        Project
appliedclusterresourcequotas                           quota.openshift.io/v1                         true         AppliedClusterResourceQuota
clusterresourcequotas                 clusterquota     quota.openshift.io/v1                         false        ClusterResourceQuota
clusterrolebindings                                    rbac.authorization.k8s.io/v1                  false        ClusterRoleBinding
clusterroles                                           rbac.authorization.k8s.io/v1                  false        ClusterRole
rolebindings                                           rbac.authorization.k8s.io/v1                  true         RoleBinding
roles                                                  rbac.authorization.k8s.io/v1                  true         Role
routes                                                 route.openshift.io/v1                         true         Route
configs                                                samples.operator.openshift.io/v1              false        Config
priorityclasses                       pc               scheduling.k8s.io/v1                          false        PriorityClass
rangeallocations                                       security.internal.openshift.io/v1             false        RangeAllocation
podsecuritypolicyreviews                               security.openshift.io/v1                      true         PodSecurityPolicyReview
podsecuritypolicyselfsubjectreviews                    security.openshift.io/v1                      true         PodSecurityPolicySelfSubjectReview
podsecuritypolicysubjectreviews                        security.openshift.io/v1                      true         PodSecurityPolicySubjectReview
rangeallocations                                       security.openshift.io/v1                      false        RangeAllocation
securitycontextconstraints            scc              security.openshift.io/v1                      false        SecurityContextConstraints
volumesnapshotclasses                                  snapshot.storage.k8s.io/v1                    false        VolumeSnapshotClass
volumesnapshotcontents                                 snapshot.storage.k8s.io/v1                    false        VolumeSnapshotContent
volumesnapshots                                        snapshot.storage.k8s.io/v1                    true         VolumeSnapshot
csidrivers                                             storage.k8s.io/v1                             false        CSIDriver
csinodes                                               storage.k8s.io/v1                             false        CSINode
storageclasses                        sc               storage.k8s.io/v1                             false        StorageClass
volumeattachments                                      storage.k8s.io/v1                             false        VolumeAttachment
brokertemplateinstances                                template.openshift.io/v1                      false        BrokerTemplateInstance
processedtemplates                                     template.openshift.io/v1                      true         Template
templateinstances                                      template.openshift.io/v1                      true         TemplateInstance
templates                                              template.openshift.io/v1                      true         Template
profiles                                               tuned.openshift.io/v1                         true         Profile
tuneds                                                 tuned.openshift.io/v1                         true         Tuned
groups                                                 user.openshift.io/v1                          false        Group
identities                                             user.openshift.io/v1                          false        Identity
useridentitymappings                                   user.openshift.io/v1                          false        UserIdentityMapping
users                                                  user.openshift.io/v1                          false        User
ippools                                                whereabouts.cni.cncf.io/v1alpha1              true         IPPool
overlappingrangeipreservations                         whereabouts.cni.cncf.io/v1alpha1              true         OverlappingRangeIPReservation

checked in 4.4 version and did not see APIVERSION being listed.
==============================================================
[core@knarra44z-5qnkl-control-plane-1 ~]$ oc api-resources | head
NAME                                  SHORTNAMES       APIGROUP                              NAMESPACED   KIND
bindings                                                                                     true         Binding
componentstatuses                     cs                                                     false        ComponentStatus
configmaps                            cm                                                     true         ConfigMap
endpoints                             ep                                                     true         Endpoints
events                                ev                                                     true         Event
limitranges                           limits                                                 true         LimitRange
namespaces                            ns                                                     false        Namespace
nodes                                 no                                                     false        Node
persistentvolumeclaims                pvc                                                    true         PersistentVolumeClaim

Based on the above moving bug to verified state.

Comment 17 errata-xmlrpc 2021-02-24 15:17:46 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.7.0 security, bug fix, and enhancement 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-2020:5633


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