Use new constraints template

This commit is contained in:
Daniel Berteaud 2024-02-20 15:39:03 +01:00
parent 89d47a023a
commit 1229b2a3d1
4 changed files with 11 additions and 9 deletions

View File

@ -10,12 +10,14 @@ job "traefik" {
count = 2 count = 2
shutdown_delay = "6s" shutdown_delay = "6s"
# Force different instances to run on distinct nodes
constraint { constraint {
operator = "distinct_hosts" operator = "distinct_hosts"
value = "true" value = "true"
} }
network { network {
mode = "bridge" mode = "bridge"
port "http" { port "http" {
@ -116,7 +118,7 @@ job "traefik" {
template { template {
data = <<_EOF data = <<_EOF
log: log:
level: INFO level: DEBUG
accessLog: accessLog:
bufferingSize: 100 bufferingSize: 100

View File

@ -1,5 +1,5 @@
log: log:
level: INFO level: DEBUG
accessLog: accessLog:
bufferingSize: 100 bufferingSize: 100

View File

@ -8,11 +8,7 @@ job "[[ .instance ]]" {
count = [[ .traefik.count ]] count = [[ .traefik.count ]]
shutdown_delay = "6s" shutdown_delay = "6s"
# Force different instances to run on distinct nodes [[ template "common/constraints" $c ]]
constraint {
operator = "distinct_hosts"
value = "true"
}
network { network {
mode = "bridge" mode = "bridge"

View File

@ -19,9 +19,13 @@ traefik:
# Number of traefik instances # Number of traefik instances
count: 2 count: 2
# Set a high priority for the job
nomad: nomad:
# Set a high priority for the job
priority: 70 priority: 70
# Ensure we run on distinct hosts
constraints:
- operator: distinct_hosts
value: true
api: api:
traefik: traefik: