mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
* nsd: block on removal of services This PR uses a WaitGroup to ensure workload removals are complete before returning from ServiceRegistrationHandler.RemoveWorkload of the nomad service provider. The de-registration of individual services still occurs asynchrously, but we must block on the parent removal call so that we do not race with further operations on the same set of services - e.g. in the case of a task restart where we de-register and then re-register the services in quick succession. Fixes #15032 * nsd: add e2e test for initial failing check and restart
47 lines
899 B
HCL
47 lines
899 B
HCL
job "checks_task_restart" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
constraint {
|
|
attribute = "${attr.kernel.name}"
|
|
value = "linux"
|
|
}
|
|
|
|
group "group" {
|
|
network {
|
|
mode = "host"
|
|
port "http" {}
|
|
}
|
|
|
|
service {
|
|
provider = "nomad"
|
|
name = "nsd-checks-task-restart-test"
|
|
port = "http"
|
|
check {
|
|
name = "alive"
|
|
type = "http"
|
|
path = "/nsd-checks-task-restart-test.txt"
|
|
interval = "2s"
|
|
timeout = "1s"
|
|
check_restart {
|
|
limit = 10
|
|
grace = "1s"
|
|
}
|
|
}
|
|
}
|
|
|
|
task "python" {
|
|
driver = "raw_exec"
|
|
user = "nobody"
|
|
config {
|
|
command = "python3"
|
|
args = ["-m", "http.server", "${NOMAD_PORT_http}", "--directory", "/tmp"]
|
|
}
|
|
resources {
|
|
cpu = 50
|
|
memory = 64
|
|
}
|
|
}
|
|
}
|
|
}
|