-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Kops Replace Command - create unprovisioned #3089
Conversation
Hi @gambol99. 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 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. I understand the commands that are listed here. |
/assign @justinsb |
95dc712
to
fc2bd6f
Compare
So this LGTM. But ... naming debate :-) kubectl replace has
Technically though I'm happy to go with (The backstory here is that as we bring kops server up, any kops vs kubectl CLI tooling differences will be very confusing.)
|
cmd/kops/replace.go
Outdated
@@ -123,16 +132,32 @@ func RunReplace(f *util.Factory, cmd *cobra.Command, out io.Writer, c *ReplaceOp | |||
if cluster == nil { | |||
return fmt.Errorf("cluster %q not found", clusterName) | |||
} | |||
_, err = clientset.InstanceGroupsFor(cluster).Update(v) | |||
// @check if the instancegroup exists already |
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.
Out of interest, why the @check
and not just check
?
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.
Just a annoying little personal quirk of mine .. I'm sure i've used it in other PRs here, i'll update and change them :-)
if err != nil { | ||
return fmt.Errorf("error replacing instanceGroup: %v", err) | ||
return fmt.Errorf("unable to check for instanceGroup: %v", err) |
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.
Interesting... I'm surprised this doesn't return an error where errors.IsNotFound(err) == true
.
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.
Indeed ... I did look to see if an error was return, as I figured there would be a ResourceNotFound or alike; but resources which are not there simply returned a nil and no error.
hi @justinsb .. I think your right and using --force makes more sense. Keeping the command line as similar to kubectl helps everyone. |
@justinsb ... changes made |
The current 'kops replace' fails if the resource does not exist, which is annoying if you want to use the feature to drive your CI. This PR adds a --create option to create any resource which does not exist. At the moment we limit this to instanceGroups only. I'd also like to see this command perhaps be renamed to kops apply?
…o the kubectl syntax
/ok-to-test /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gambol99, justinsb 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 |
This made it into kops 1.7.1-beta.2 (git-26ca294) but it did not make it into 1.7.1 release? |
This PR fixes the `kops replace --force` flag which was introduce in [#PR3099](kubernetes#3089). The `--force` stopped working when 65aea59 was merged and the api started returning an actual error for NotFound
The current 'kops replace' fails if the resource does not exist, which is annoying if you want to use the feature to drive your CI. This PR adds a --create option to create any resource which does not exist. At the moment we limit this to instanceGroups only. I'd also like to see this command perhaps be renamed to kops apply?