-
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
Add kops delete instance command #9784
Add kops delete instance command #9784
Conversation
611a052
to
efeb402
Compare
efeb402
to
b4850be
Compare
Moved some stuff into rollingupgrade and made the functions there private again. Feels cleaner this way. |
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.
Clever use of the rolling update code! I like it.
} | ||
err := c.detachInstance(cloudMember) | ||
if err != nil { | ||
return fmt.Errorf("failed to detach instance: %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.
The most likely cause of this would be that the cloud provider doesn't support surging. It might be better to default detach
to false for such cloud providers.
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.
From this codes perspective, one doesn't know why it failed, so it is a bit dangerous to just carry on. I agree that one could ignore surging on cloud providers that do not support it. Maybe Cloud.DetachInstance
should be its own interface that one could test for?
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.
I missed that this was a param passed on. Changed the functions to figure out the instance group role on its own instead.
@@ -561,3 +561,21 @@ func (c *RollingUpdateCluster) deleteNode(ctx context.Context, node *corev1.Node | |||
|
|||
return 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.
Should have doc comment. Should have added unit test(s).
You might want to make the A better name might be |
56c1653
to
366390e
Compare
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.
Great feature! Thanks for adding that @olemarkus 🙇
@MoShitrit Thanks. Fixed docs according to your comments. |
Thanks @olemarkus! |
a58b816
to
1ab5029
Compare
Thanks for catching. Fixed. |
/lgtm |
@olemarkus to keep things consistent with other commands, this one needs |
2a12a05
to
c7f0b10
Compare
Add support for deleting instance by k8s node name Add yes flag
c7f0b10
to
ff6c049
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hakman, olemarkus The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test all |
This command makes it possible to delete a single instance.
It is implemented mostly reusing rollingupdate code. This meant opening more of the API than I liked, but given the intricate way that
RollingUpdate
is implemented, it was hard to get around. Ideally some of the logic could be moved tocloudinstances
but quickly ran intofi
circular imports when going down that route.