-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backport #14348 (drain: use client status to determine drain is compl…
…ete) (#16880) If an allocation is slow to stop because of `kill_timeout` or `shutdown_delay`, the node drain is marked as complete prematurely, even though drain monitoring will continue to report allocation migrations. This impacts the UI or API clients that monitor node draining to shut down nodes. This changeset updates the behavior to wait until the client status of all drained allocs are terminal before marking the node as done draining. Co-authored-by: Tim Gross <[email protected]>
- Loading branch information
1 parent
6e911f0
commit 0a068ec
Showing
7 changed files
with
362 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
drain: Fixed a bug where drains would complete based on the server status and not the client status of an allocation | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
job "drain_killtimeout" { | ||
|
||
constraint { | ||
attribute = "${attr.kernel.name}" | ||
value = "linux" | ||
} | ||
|
||
group "group" { | ||
|
||
task "task" { | ||
driver = "docker" | ||
|
||
kill_timeout = "30s" # matches the agent's max_kill_timeout | ||
|
||
config { | ||
image = "busybox:1" | ||
command = "/bin/sh" | ||
args = ["local/script.sh"] | ||
} | ||
|
||
# this job traps SIGINT so that we can assert that we've forced the drain | ||
# to wait until the client status has been updated | ||
template { | ||
data = <<EOF | ||
#!/bin/sh | ||
trap 'sleep 60' 2 | ||
sleep 600 | ||
EOF | ||
|
||
destination = "local/script.sh" | ||
change_mode = "noop" | ||
} | ||
|
||
resources { | ||
cpu = 256 | ||
memory = 128 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.