mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
* client: ignore restart issued to terminal allocations This PR fixes a bug where issuing a restart to a terminal allocation would cause the allocation to run its hooks anyway. This was particularly apparent with group_service_hook who would then register services but then never deregister them - as the allocation would be effectively in a "zombie" state where it is prepped to run tasks but never will. * e2e: add e2e test for alloc restart zombies * cl: tweak text Co-authored-by: Tim Gross <tgross@hashicorp.com> --------- Co-authored-by: Tim Gross <tgross@hashicorp.com>
60 lines
1.0 KiB
HCL
60 lines
1.0 KiB
HCL
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
job "alloc_zombie" {
|
|
|
|
group "group" {
|
|
network {
|
|
mode = "host"
|
|
port "http" {}
|
|
}
|
|
|
|
service {
|
|
name = "alloczombie"
|
|
port = "http"
|
|
provider = "nomad"
|
|
|
|
check {
|
|
name = "alloczombiecheck"
|
|
type = "http"
|
|
port = "http"
|
|
path = "/does/not/exist.txt"
|
|
interval = "2s"
|
|
timeout = "1s"
|
|
check_restart {
|
|
limit = 1
|
|
grace = "3s"
|
|
}
|
|
}
|
|
}
|
|
|
|
reschedule {
|
|
attempts = 3
|
|
interval = "1m"
|
|
delay = "5s"
|
|
delay_function = "constant"
|
|
unlimited = false
|
|
}
|
|
|
|
restart {
|
|
attempts = 0
|
|
delay = "5s"
|
|
mode = "fail"
|
|
}
|
|
|
|
task "python" {
|
|
driver = "raw_exec"
|
|
|
|
config {
|
|
command = "python3"
|
|
args = ["-m", "http.server", "${NOMAD_PORT_http}", "--directory", "/tmp"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 10
|
|
memory = 64
|
|
}
|
|
}
|
|
}
|
|
}
|