diff --git a/command/node_drain.go b/command/node_drain.go index 068ba9aeb149..040b16ee19fa 100644 --- a/command/node_drain.go +++ b/command/node_drain.go @@ -49,6 +49,9 @@ Node Drain Options: -detach Return immediately instead of entering monitor mode. + -monitor + Enter monitor mode directly without modifying the drain status. + -force Force remove allocations off the node immediately. @@ -136,7 +139,7 @@ func (c *NodeDrainCommand) Run(args []string) int { } // Check that enable or disable is not set with monitor - if monitor && enable || monitor && disable { + if monitor && (enable || disable) { c.Ui.Error("The -monitor flag cannot be used with the '-enable' or '-disable' flags") c.Ui.Error(commandErrorText(c)) return 1 diff --git a/website/source/docs/commands/node/drain.html.md.erb b/website/source/docs/commands/node/drain.html.md.erb index d03ca3f0d6cf..1abbc4cfdcf9 100644 --- a/website/source/docs/commands/node/drain.html.md.erb +++ b/website/source/docs/commands/node/drain.html.md.erb @@ -57,6 +57,7 @@ operation is desired. node. Remaining allocations after the deadline are force removed from the node. Defaults to 1 hour. * `-detach`: Return immediately instead of entering monitor mode. +* `-monitor`: Enter monitor mode directly without modifying the drain status. * `-force`: Force remove allocations off the node immediately. * `-no-deadline`: No deadline allows the allocations to drain off the node without being force stopped after a certain deadline. @@ -114,6 +115,14 @@ $ nomad node drain -disable -keep-ineligible 4d2ba53b ... ``` +Enable drain mode and detach from monitoring, then reattach later: + +``` +$ nomad node drain -enable -detach -self +... +$ nomad node drain -self -monitor +... +``` [eligibility]: /docs/commands/node/eligibility.html [migrate]: /docs/job-specification/migrate.html