-
Notifications
You must be signed in to change notification settings - Fork 40k
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 for cronjobs #58753
Conversation
/lgtm |
/retest |
/approve |
Can we change the release note to mention that this is not just for cronjob? My understanding is that the change will affect all resource types. |
You're right, this will fix the problem for all resources that do not exist in the default version. I've updated the description accordingly. |
/retest |
pkg/kubectl/cmd/explain.go
Outdated
if err != nil { | ||
return err | ||
if len(gvk.Version) == 0 { | ||
groupMeta, err := scheme.Registry.Group(gvk.Group) |
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.
pre-existing, but this comand should not have any dependency on a compiled in scheme. @juanvallejo see about removing this?
pkg/kubectl/cmd/explain.go
Outdated
groupMeta, err := scheme.Registry.Group(gvk.Group) | ||
if err != nil { | ||
return err | ||
if len(gvk.Version) == 0 { |
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.
does this branch get hit? I'm not seeing why we'd end up here. The mapper should give us a specific version.
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's not, it might be a leftover from the pre-mapper-handling-versions days ;) I'll remove it.
e1d8a57
to
c7efab4
Compare
/lgtm |
/approve no-issue |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cblecker, deads2k, juanvallejo, soltysh Associated issue requirement bypassed by: deads2k The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
kubectl explain cronjob
was failing witherror: Couldn't find resource for "batch/v1, Kind=CronJob"
the reason for that is that even though we were getting the group and version from the mapper, we always rewrote it with the default value for a specific group, unless user specified the output version.Special notes for your reviewer:
Release note:
for review:
/assign @juanvallejo
for approval:
/assign @deads2k