Build traefik static config better when services aren't found

This commit is contained in:
IamTheFij 2022-04-15 12:13:00 -07:00
parent 630a85a2f2
commit ba1b5166b9
1 changed files with 9 additions and 3 deletions

View File

@ -149,24 +149,30 @@ job "traefik" {
rule = "Host(`vault.${var.base_hostname}`)" rule = "Host(`vault.${var.base_hostname}`)"
[http.services] [http.services]
<< with service "nomad-client" ->>
[http.services.nomad] [http.services.nomad]
[http.services.nomad.loadBalancer] [http.services.nomad.loadBalancer]
<< range service "nomad-client" >> << range . ->>
[[http.services.nomad.loadBalancer.servers]] [[http.services.nomad.loadBalancer.servers]]
url = "http://<< .Address >>:<< .Port >>" url = "http://<< .Address >>:<< .Port >>"
<< end >> << end >>
<<- end >>
<< with service "consul" ->>
[http.services.consul] [http.services.consul]
[http.services.consul.loadBalancer] [http.services.consul.loadBalancer]
<< range service "consul" >> << range . ->>
[[http.services.consul.loadBalancer.servers]] [[http.services.consul.loadBalancer.servers]]
url = "http://<< .Address >>:<< .Port >>" url = "http://<< .Address >>:<< .Port >>"
<< end >> << end >>
<<- end >>
<< with service "vault" ->>
[http.services.vault] [http.services.vault]
[http.services.vault.loadBalancer] [http.services.vault.loadBalancer]
<< range service "vault" >> << range . ->>
[[http.services.vault.loadBalancer.servers]] [[http.services.vault.loadBalancer.servers]]
url = "http://<< .Address >>:<< .Port >>" url = "http://<< .Address >>:<< .Port >>"
<< end >> << end >>
<<- end >>
EOH EOH
destination = "/config/conf/route-hashi.toml" destination = "/config/conf/route-hashi.toml"
change_mode = "noop" change_mode = "noop"