Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications. Nomad is easy to operate and scale and has native Consul and Vault integrations.
But it likely happens in previous versions as well.
Operating system and Environment details
N/A
Issue
When a job with canary deployments changes its datacenters and, during deployment, an allocation for the previous version fails, the replacement allocations are created in nodes for the new datacenters value instead of the original one.
Reproduction steps
Start a Nomad cluster with clients in two datacenters. You start a nomad agent -dev and run the job below to create some extra clients.
Nomad clients jobfile
$ watch -n1 nomad job allocs sleep
ID Node ID Task Group Version Desired Status Created Modified
5db9c92b 74384522 sleep 0 run pending 11s ago 11s ago
191fcde0 74384522 sleep 1 run running 58s ago 47s ago
605c2ac1 a8201b46 sleep 0 run running 1m16s ago 1m5s ago
beb6b693 a8201b46 sleep 0 stop failed 1m16s ago 11s ago
Expected Result
The replacement allocation is created in the same node and in the same datacenter as it was originally.
Actual Result
The replacement allocation is created in the new datacenter.
Job file (if appropriate)
job "sleep" {
datacenters = ["dc2"]
update {
max_parallel = 1
canary = 1
auto_revert = true
}
group "sleep" {
count = 2
task "sleep" {
driver = "raw_exec"
config {
command = "/bin/bash"
args = ["${NOMAD_TASK_DIR}/script.sh"]
}
template {
data = <<EOF
while true; do
if [ "$NOMAD_ALLOC_INDEX" -gt "0" ]; then
echo "Boom"
exit 1
fi
sleep 3
done
EOF
destination = "${NOMAD_TASK_DIR}/script.sh"
}
}
}
}
Nomad version
But it likely happens in previous versions as well.
Operating system and Environment details
N/A
Issue
When a job with canary deployments changes its
datacenters
and, during deployment, an allocation for the previous version fails, the replacement allocations are created in nodes for the newdatacenters
value instead of the original one.Reproduction steps
nomad agent -dev
and run the job below to create some extra clients.Nomad clients jobfile
Update the job's datacenter.
Expected Result
The replacement allocation is created in the same node and in the same datacenter as it was originally.
Actual Result
The replacement allocation is created in the new datacenter.
Job file (if appropriate)