kcp icon indicating copy to clipboard operation
kcp copied to clipboard

`kubectl explain` is broken for kcp api-resources

Open xingxingxia opened this issue 3 years ago • 3 comments

Describe the bug kubectl explain is broken for kcp api-resources, e.g. locations, clusterworkspaces, workspaces et al. Works well for other k8s traditional resources, though, clusterroles.

To Reproduce Steps to reproduce the behavior:

  1. Login to kcp "stable" service as of this issue is filed
  2. Show current ws: $ kubectl kcp ws Current workspace is "root:rh-sso-158xxxx". $ kubectl api-resources
NAME                              SHORTNAMES   APIVERSION                             NAMESPACED   KIND
...
clusterroles                                   rbac.authorization.k8s.io/v1           false        ClusterRole
...
locations                                      scheduling.kcp.dev/v1alpha1            false        Location
clusterworkspaces                              tenancy.kcp.dev/v1alpha1               false        ClusterWorkspace
...
workspaces                                     tenancy.kcp.dev/v1beta1                false        Workspace
  1. Run kubectl explain for kcp resources to know the description of them $ kubectl explain locations error: couldn't find resource for "scheduling.kcp.dev/v1alpha1, Kind=Location" Checking if verbose output returns more clues: $ kubectl explain locations --v 6
I0705 16:21:06.184336    9707 loader.go:372] Config loaded from file:  /home/xxia/my/env/kcp/kubeconfig
I0705 16:21:08.049208    9707 round_trippers.go:553] GET https://kcp-stable.apps.../clusters/root:rh-sso-158xxxx/openapi/v2?timeout=32s 200 OK in 1864 milliseconds
error: couldn't find resource for "scheduling.kcp.dev/v1alpha1, Kind=Location"

$ kubectl explain clusterworkspaces error: couldn't find resource for "tenancy.kcp.dev/v1alpha1, Kind=ClusterWorkspace" $ kubectl explain workspaces error: couldn't find resource for "tenancy.kcp.dev/v1beta1, Kind=Workspace" Above commands fail to return description for kcp resources. It works well for k8s traditional resources, though, clusterroles: $ kubectl explain clusterroles

KIND:     ClusterRole
VERSION:  rbac.authorization.k8s.io/v1

DESCRIPTION:
     ClusterRole is a cluster level, logical grouping of PolicyRules that can be

Expected behavior kubectl explain should work well to return description for kcp resources like for k8s traditional resources.

Additional context

xingxingxia avatar Jul 05 '22 08:07 xingxingxia

This is APIBinding related

ncdc avatar Jul 05 '22 15:07 ncdc

Issues go stale after 90d of inactivity. After a furter 30 days, they will turn rotten. Mark the issue as fresh with /remove-lifecycle stale.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kcp-ci-bot avatar Apr 13 '24 20:04 kcp-ci-bot

Is there an plan to work on this? I'm seeing this for exported/bound resources and not just the kcp APIs

gmrodgers avatar Apr 17 '24 16:04 gmrodgers

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kcp-ci-bot avatar May 18 '24 20:05 kcp-ci-bot

/remove-lifecycle rotten

embik avatar May 19 '24 13:05 embik

This should work now since #3118 got merged. @gmrodgers sorry for the late reply. Any chance you can give it a spin and confirm please?

This is how it looks like for me on latest main:

$ kubectl explain workspace
GROUP:      tenancy.kcp.io
KIND:       Workspace
VERSION:    v1alpha1

DESCRIPTION:
    Workspace defines a generic Kubernetes-cluster-like endpoint, with standard
    Kubernetes discovery APIs, OpenAPI and resource API endpoints.
     A workspace can be backed by different concrete types of workspace
    implementation, depending on access pattern. All workspace implementations
    share the characteristic that the URL that serves a given workspace can be
    used with standard Kubernetes API machinery and client libraries and command
    line tools.

FIELDS:
[...]

embik avatar May 19 '24 13:05 embik

The PR mentioned above was included in v0.24.0 and if I didn't misunderstand the issue it should work fine. Closing this.

embik avatar Jun 03 '24 07:06 embik