-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Added api discovery to kubectl run, based on which we decide which generators to use #22849
Conversation
Labelling this PR as size/M |
GCE e2e build/test failed for commit 3077c5d6cc6de9722733bf05818785b076430876. 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. |
GCE e2e build/test passed for commit daf955834f265373ac7d706888808dbc7f5402f3. |
if restartPolicy == api.RestartPolicyAlways { | ||
generatorName = "deployment/v1beta1" | ||
if contains(groupList, "extensions/v1beta1") { |
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.
use constants for group/versions and use GroupVersion
objects.
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.
You're going to need some comments explaining priority decisions here. I know it, but I think its because I just read the issue and a month from now someone is going to be looking through. and wondering.
If we have a decent mock for the discovery client I'd like to see a unit test or two, but this looks fine. |
groupList, err := client.Discovery().ServerGroups() | ||
if err != nil { | ||
// this cover the cases where old servers do not expose discovery | ||
groupList = 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 is what makes it work against 1.1?
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.
That's my idea, I don't have any 1.1 cluster at hand :( Although I can compile 1.1 version and see what I'm gonna get.
Thanks for jumping on this so quickly! Could you please update the description text for --generator? |
@deads2k @bgrant0607 I've addressed all the comments. Tested that against 1.1 cluster. It nicely falls back all the way back to running pods if jobs are disabled in 1.1 (the default behavior). ptal |
Thanks, @soltysh. Please run hack/update-all.sh. |
GCE e2e build/test failed for commit aefb94e2224dfa9a92b58241adc3514b86cf8ed4. 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. |
@bgrant0607 done, sorry |
LGTM, assuming tests pass. Thanks much |
@@ -254,6 +276,22 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob | |||
return nil | |||
} | |||
|
|||
func contains(resourcesList map[string]*unversioned.APIResourceList, gv unversioned.GroupVersion, name string) bool { |
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.
GroupVersionResource
?
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.
Also, how about a TODO
to make this more library-esq. It looks like it would have general utility as a layer on top of a discovery client.
Thanks for the comments @deads2k. Removed lgtm. Please reapply when your comments are addressed. |
GCE e2e build/test failed for commit d5659eb8a4ae6cdc5730d0c26f4815f5ee02b5ea. 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. |
On it... |
@deads2k @bgrant0607 comments addressed ptal. |
If more tweaks are needed or tests fail please pick up this PR because I'll be leaving and won't be able to touch it and I do realize this is important to have in as soon as possible. |
Thanks @soltysh |
There are no unit test results, so I can't see what failed. @k8s-bot unit test this issue: #IGNORE |
lgtm |
GCE e2e build/test passed for commit f27871e. |
All green. Merging @k8s-oncall |
Added api discovery to kubectl run, based on which we decide which generators to use
Added api discovery to kubectl run, based on which we decide which generators to use
Added api discovery to kubectl run, based on which we decide which generators to use
Added api discovery to kubectl run, based on which we decide which generators to use
Added api discovery to kubectl run, based on which we decide which generators to use
Fixes #22836.
@bgrant0607 @jlowdermilk @lavalamp @deads2k @soltysh @janetkuo wdyt?
PS If fixes/changes are needed after 4pm UTC take over this PR and resubmit since I'll be out the entire evening.