@xiangpengzhao: Reiterating the mentions to trigger a notification:
@kubernetes/sig-cli-bugs.
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.![]()
cc @mbohlool
This look like a problem with old swagger 1.2. We do not aggregate swagger 1.2 spec. When kubectl move to OpenAPI, it should by fix this by design.
@nikhita: you can't re-open an issue/PR unless you authored it or you are assigned to it.
In response to this:
This is still not fixed (even after kubectl moving to OpenAPI).
There are two problems here:
- kubectl uses groups registered into a group registry. This can be fixed by:
--- a/pkg/kubectl/cmd/explain.go +++ b/pkg/kubectl/cmd/explain.go @@ -26,7 +26,6 @@ import ( "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/explain" - "k8s.io/kubernetes/pkg/kubectl/scheme" "k8s.io/kubernetes/pkg/kubectl/util/i18n" ) @@ -91,7 +90,6 @@ func RunExplain(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, ar return err } - // TODO: We should deduce the group for a resource by discovering the supported resources at server. fullySpecifiedGVR, groupResource := schema.ParseResourceArg(inModel) gvk := schema.GroupVersionKind{} if fullySpecifiedGVR != nil { @@ -104,20 +102,12 @@ func RunExplain(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, ar } } - if len(apiVersionString) == 0 { - groupMeta, err := scheme.Registry.Group(gvk.Group) - if err != nil { - return err - } - apiVersion = groupMeta.GroupVersion - - } else { - apiVersion, err = schema.ParseGroupVersion(apiVersionString) - if err != nil { + if len(apiVersionString) != 0 { + if apiVersion, err = schema.ParseGroupVersion(apiVersionString); err != nil { return err } + gvk = apiVersion.WithKind(gvk.Kind) } - gvk = apiVersion.WithKind(gvk.Kind) resources, err := f.OpenAPISchema() if err != nil {However, after this it gives:
error: Couldn't find resource for "apiextensions.k8s.io/v1beta1, Kind=CustomResourceDefinition"
- This occurs because of incorrect openAPI schema. The schema does not contain apiextensions and apiregisteration.
kubectl explain looks up the gvk of the resource in question from a list of resources:
It gets the gvk here:
parseGroupVersionKindfinds the gvk throughgroupVersionKindExtensionKey:Here,
groupVersionKindExtensionKeyis"x-kubernetes-group-version-kind"and is the key used to lookup the GroupVersionKind value for an object definition from the definition's "extensions" map.However, we do not generate
x-kubernetes-extensions for apiextensions-apiserver and aggregator yet (#52741), due to which it fails./reopen
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
—
—
Reopened #49465.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
/remove-lifecycle stale
/assign
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
—
/remove-lifecycle stale
Closed #49465.
fixed in 1.11 in #64174