-
Notifications
You must be signed in to change notification settings - Fork 2k
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
command: add '-monitor' flag to node drain #4260
Conversation
command/node_drain.go
Outdated
// If monitoring the drain start the montior and return when done | ||
if monitor { | ||
c.Ui.Info(fmt.Sprintf("%s: Monitoring node %q: Ctrl-C to detach monitoring", formatTime(time.Now()), node.ID)) | ||
c.monitorDrain(client, context.Background(), node, node.ModifyIndex-1, ignoreSystem) |
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.
@dadgar does this seem reasonable to -1
the index? Otherwise the drain blocks until the node is updated, which causes odd UX if the node has completed draining.
0a738be
to
59db0cb
Compare
command/node_drain.go
Outdated
|
||
if err := flags.Parse(args); err != nil { | ||
return 1 | ||
} | ||
|
||
// Check that enable or disable is not set with monitor | ||
if monitor && enable || monitor && disable { |
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.
monitor && ( enable || disable )
?
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.
Without the context, that looks kind of goofy.
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.
Thanks!
CHANGELOG.md
Outdated
@@ -1,6 +1,8 @@ | |||
## 0.8.4 (Unreleased) | |||
|
|||
IMPROVEMENTS: | |||
* cli: Add node drain monitoring with new `-monitor` flag on node drain |
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.
So this should be below the other since they are both under CLI but the length of this changelog entry is longer
@@ -113,7 +113,8 @@ func (c *NodeDrainCommand) Name() string { return "node-drain" } | |||
|
|||
func (c *NodeDrainCommand) Run(args []string) int { | |||
var enable, disable, detach, force, | |||
noDeadline, ignoreSystem, keepIneligible, self, autoYes bool | |||
noDeadline, ignoreSystem, keepIneligible, |
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.
missing help text
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.
Website command docs
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.
added in 317abec
command/node_drain_test.go
Outdated
out = outBuf.String() | ||
t.Logf("Output:\n%s", out) | ||
|
||
require.Contains(out, "marked all allocations for migration") |
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.
Hmm that is pretty jank. If you run nomad node drain -monitor <node that has never been marked for drain>
it will say that all allocations have been marked for migration even if that isn't true.
I think we need to modify this (https://github.com/hashicorp/nomad/blob/51440e24a7886986d74fcb94320707842adcb39c/api/nodes.go) to track whether the DrainStrategy was ever non-nil and then if it becomes nil it can print that message. Otherwise if it is nil and has never been set to a non-nil strategy we can print a more generic message like, "no drain strategy set"
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.
fixed in a66d89b
06c8cdc
to
0c62b9c
Compare
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
No description provided.