Skip to content
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

Merged
merged 1 commit into from
Jan 25, 2018

Conversation

soltysh
Copy link
Contributor

@soltysh soltysh commented Jan 24, 2018

What this PR does / why we need it:
kubectl explain cronjob was failing with error: 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:

Fix kubectl explain for resources not existing in default version of API group

for review:
/assign @juanvallejo
for approval:
/assign @deads2k

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 24, 2018
@k8s-ci-robot k8s-ci-robot requested review from cblecker and dims January 24, 2018 16:29
@juanvallejo
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 24, 2018
@soltysh
Copy link
Contributor Author

soltysh commented Jan 24, 2018

/retest

@cblecker
Copy link
Member

/approve
for hack/

@tengqm
Copy link
Contributor

tengqm commented Jan 25, 2018

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.

@soltysh
Copy link
Contributor Author

soltysh commented Jan 25, 2018

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.

@soltysh
Copy link
Contributor Author

soltysh commented Jan 25, 2018

/retest

if err != nil {
return err
if len(gvk.Version) == 0 {
groupMeta, err := scheme.Registry.Group(gvk.Group)
Copy link
Contributor

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?

groupMeta, err := scheme.Registry.Group(gvk.Group)
if err != nil {
return err
if len(gvk.Version) == 0 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 25, 2018
@juanvallejo
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 25, 2018
@deads2k
Copy link
Contributor

deads2k commented Jan 25, 2018

/approve no-issue

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 25, 2018
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 884e4b7 into kubernetes:master Jan 25, 2018
@soltysh soltysh deleted the explain_cronjobs branch January 25, 2018 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants