From 1229b2a3d1f760b2f7acde1801b24203ae2600c9 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 20 Feb 2024 15:39:03 +0100 Subject: [PATCH] Use new constraints template --- example/traefik.nomad.hcl | 6 ++++-- templates/traefik.yml.tpl | 2 +- traefik.nomad.hcl | 6 +----- variables.yml | 6 +++++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/example/traefik.nomad.hcl b/example/traefik.nomad.hcl index 0053367..89e9473 100644 --- a/example/traefik.nomad.hcl +++ b/example/traefik.nomad.hcl @@ -10,12 +10,14 @@ job "traefik" { count = 2 shutdown_delay = "6s" - # Force different instances to run on distinct nodes + + constraint { operator = "distinct_hosts" value = "true" } + network { mode = "bridge" port "http" { @@ -116,7 +118,7 @@ job "traefik" { template { data = <<_EOF log: - level: INFO + level: DEBUG accessLog: bufferingSize: 100 diff --git a/templates/traefik.yml.tpl b/templates/traefik.yml.tpl index 42214f5..e3f3067 100644 --- a/templates/traefik.yml.tpl +++ b/templates/traefik.yml.tpl @@ -1,5 +1,5 @@ log: - level: INFO + level: DEBUG accessLog: bufferingSize: 100 diff --git a/traefik.nomad.hcl b/traefik.nomad.hcl index 800baf3..bfdb3e5 100644 --- a/traefik.nomad.hcl +++ b/traefik.nomad.hcl @@ -8,11 +8,7 @@ job "[[ .instance ]]" { count = [[ .traefik.count ]] shutdown_delay = "6s" - # Force different instances to run on distinct nodes - constraint { - operator = "distinct_hosts" - value = "true" - } +[[ template "common/constraints" $c ]] network { mode = "bridge" diff --git a/variables.yml b/variables.yml index 6752c08..29494a0 100644 --- a/variables.yml +++ b/variables.yml @@ -19,9 +19,13 @@ traefik: # Number of traefik instances count: 2 - # Set a high priority for the job nomad: + # Set a high priority for the job priority: 70 + # Ensure we run on distinct hosts + constraints: + - operator: distinct_hosts + value: true api: traefik: