New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(kubectl): explain crds whose resource name is the same as builtin objects #89505
fix(kubectl): explain crds whose resource name is the same as builtin objects #89505
Conversation
Hi @knight42. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/assign @apelisse |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add a unit test to show this works as expected.
/priority important-soon |
433457b
to
51fe4ae
Compare
@seans3 I have updated the tests to show that |
099cf4d
to
777a6d0
Compare
/assign @deads2k |
@seans3 I managed to add an e2e test to verify that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also squash your changes into a single commit to start with.
/assign
} | ||
// Only returning the resource name is not enough. CRDs may have the same resource name. | ||
// TODO(knight42): not sure whether we need to speicfy the version here. | ||
return fmt.Sprintf("%s.%s", singular, gvr.Group), fieldsPath, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not changing this and return GroupVersionResource, fieldsPath and error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How this will work in the situation where I specify --api-version
that is different than what you discovered here? Should there be an error in explain flow? I'd expect one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How this will work in the situation where I specify --api-version that is different than what you discovered here
I would like to respect the given apiVersion, since users are likely to know what they are doing if they specify --api-version
explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not changing this and return GroupVersionResource, fieldsPath and error here?
fixed
@knight42 pls ping me on slack when you update this. |
777a6d0
to
370894d
Compare
370894d
to
397f107
Compare
/test pull-kubernetes-conformance-kind-ga-only-parallel |
1 similar comment
/test pull-kubernetes-conformance-kind-ga-only-parallel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: knight42, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Review the full test history for this PR. Silence the bot with an |
2 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
/test pull-kubernetes-e2e-gce |
@@ -120,6 +126,11 @@ var _ = SIGDescribe("CustomResourcePublishOpenAPI [Privileged:ClusterAdmin]", fu | |||
framework.Failf("%v", err) | |||
} | |||
|
|||
ginkgo.By("kubectl explain works for CR with the same resource name as built-in object") | |||
if err := verifyKubectlExplain(f.Namespace.Name, customServiceShortName+".spec", `(?s)DESCRIPTION:.*Specification of CustomService.*FIELDS:.*dummy.*<string>.*Dummy property`); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this modified a conformance test and introduced a test that has been flaking. This needs to be done in a non-conformance test first to demonstrate the test is stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liggitt should I remove this test from the conformance tests first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, revert the conformance test to its previous state and isolate the new test in a non-conformance e2e test (marked as flaky until the test has been deflaked)
What type of PR is this?
/kind bug
What this PR does / why we need it:
Currently, if the resource name of a custom resource is the same as one of builtin objects(like knative Service and core Service),
kubectl explain
fails to find the correct resource even a distinguishable short name is given.Which issue(s) this PR fixes:
Fixes kubernetes/kubectl#749
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: