kcp-dev / kcp

Kubernetes-like control planes for form-factors and use-cases beyond Kubernetes and container workloads.
https://kcp.io
Apache License 2.0
2.35k stars 381 forks source link

`kubectl explain` is broken for kcp api-resources #1446

Closed xingxingxia closed 4 months ago

xingxingxia commented 2 years ago

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
  3. 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**
ncdc commented 2 years ago

This is APIBinding related

kcp-ci-bot commented 6 months ago

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

gmrodgers commented 6 months ago

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

kcp-ci-bot commented 5 months ago

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

embik commented 5 months ago

/remove-lifecycle rotten

embik commented 5 months ago

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 commented 4 months ago

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