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

command: add '-monitor' flag to node drain #4260

Merged
merged 5 commits into from
May 24, 2018
Merged

Conversation

nickethier
Copy link
Member

No description provided.

// 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)
Copy link
Member Author

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.


if err := flags.Parse(args); err != nil {
return 1
}

// Check that enable or disable is not set with monitor
if monitor && enable || monitor && disable {
Copy link
Contributor

Choose a reason for hiding this comment

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

monitor && ( enable || disable ) ?

Copy link

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.

Copy link
Member Author

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
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

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

missing help text

Copy link
Contributor

Choose a reason for hiding this comment

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

Website command docs

Copy link
Member Author

Choose a reason for hiding this comment

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

added in 317abec

out = outBuf.String()
t.Logf("Output:\n%s", out)

require.Contains(out, "marked all allocations for migration")
Copy link
Contributor

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"

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in a66d89b

@nickethier nickethier merged commit 0574bd9 into master May 24, 2018
@nickethier nickethier deleted the f-cli-node-drain-monitor branch July 11, 2018 01:32
@github-actions
Copy link

github-actions bot commented Mar 1, 2023

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants