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

Make kubectl edit not convert GV on edits #23437

Merged

Conversation

DirectXMan12
Copy link
Contributor

@DirectXMan12 DirectXMan12 commented Mar 24, 2016

Previously, kubectl edit was using a decoder to load in edits that
converted to the internal version. It would then re-encode this
decoded value to produce a patch. However, if you were editing
in the object in a GroupVersion that was not the internal version,
this would cause the kubectl edit command to attempt to produce
a patch which changed the GroupVersion, which would fail.

Now, we use a plain deserializer instead, so no conversion or
defaulting occurs when loading in the edited file.

Ref #23378

@DirectXMan12
Copy link
Contributor Author

cc @stevekuznetsov cc @adohe

@@ -120,12 +120,18 @@ func RunEdit(f *cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args
return err
}

// NB: we use `f.Decoder(false)` to get a plain deserializer for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest moving this comment to immediately before the f.Decoder(false) line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would, but I didn't want to have a large block comment in the middle of a struct instantiation. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's an issue. If the comment isn't living right next to this line, I could foresee someone changing it back to true without noticing the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@k8s-github-robot k8s-github-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 24, 2016
@k8s-bot
Copy link

k8s-bot commented Mar 24, 2016

GCE e2e build/test failed for commit 95f08be.

Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake.

Previously, kubectl edit was using a decoder to load in edits that
converted to the internal version.  It would then re-encode this
decoded value to produce a patch.  However, if you were editing
in the object in a GroupVersion that was not the internal version,
this would cause the kubectl edit command to attempt to produce
a patch which changed the GroupVersion, which would fail.

Now, we use a plain deserializer instead, so no conversion or
defaulting occurs when loading in the edited file.

Fixes kubernetes#23378
@DirectXMan12 DirectXMan12 force-pushed the bug/cannot-edit-across-gv branch from 95f08be to bc41430 Compare March 24, 2016 19:15
@k8s-bot
Copy link

k8s-bot commented Mar 24, 2016

GCE e2e build/test passed for commit bc41430.

@k8s-github-robot
Copy link

The author of this PR is not in the whitelist for merge, can one of the admins add the 'ok-to-merge' label?

@brendandburns
Copy link
Contributor

Over to @janetkuo since she knows this code better than I do.

@janetkuo
Copy link
Member

janetkuo commented Apr 6, 2016

@k8s-bot e2e test this issue: #IGNORE (Build step 'Execute shell' marked build as failure?)

@k8s-bot
Copy link

k8s-bot commented Apr 6, 2016

GCE e2e build/test passed for commit bc41430.

@janetkuo
Copy link
Member

janetkuo commented Apr 7, 2016

@k8s-bot node e2e test this

@janetkuo janetkuo added lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed release-note-none Denotes a PR that doesn't merit a release note. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Apr 7, 2016
@janetkuo
Copy link
Member

janetkuo commented Apr 7, 2016

@DirectXMan12 Do you plan to solve the get/validation issue in this PR too? If not, the "fixes" keyword needs to be removed from the PR description. Otherwise the issue will be closed.

@k8s-bot
Copy link

k8s-bot commented Apr 7, 2016

GCE e2e build/test passed for commit bc41430.

@DirectXMan12
Copy link
Contributor Author

@janetkuo I recall not being able to reproduce the validation issue, just the edit issue (which is why, IIRC, I put it as fixes). I'll double-check that.

@DirectXMan12
Copy link
Contributor Author

@janetkuo just double checked, and I was able to repeat the validation "issue", although I'm not entirely certain it's an issue -- if you don't explicitly pass --validate=false, you get a nice message about how you are missing scaleTargetRef. It appears to only be if you explicitly pass --validate=false, at which point kubectl happily converts to the internal version and submits the request.

@janetkuo janetkuo added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 15, 2016
@janetkuo
Copy link
Member

Let's merge this first and keep the issue open then.

@k8s-bot
Copy link

k8s-bot commented Apr 15, 2016

GCE e2e build/test passed for commit bc41430.

@k8s-bot
Copy link

k8s-bot commented Apr 15, 2016

GCE e2e build/test passed for commit bc41430.

@k8s-bot
Copy link

k8s-bot commented Apr 15, 2016

GCE e2e build/test passed for commit bc41430.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit ed87db5 into kubernetes:master Apr 15, 2016
@DirectXMan12 DirectXMan12 deleted the bug/cannot-edit-across-gv branch October 3, 2017 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants