traefik/templates/traefik.yml.tpl

71 lines
1.7 KiB
Smarty

log:
level: INFO
accessLog:
bufferingSize: 100
entryPoints:
[[- if conv.ToBool .prometheus.enabled ]]
metrics:
address: "127.0.0.1:9500"
[[- end ]]
[[- range $name, $def := .traefik.entrypoints ]]
[[- if or (not (has $def "enabled")) ($def.enabled) ]]
[[ $name ]]:
address: ":{{ env "NOMAD_PORT_[[ $name | regexp.Replace "[\\.\\-]" "_" ]]" }}[[ if has $def "protocol" ]]/[[ $def.protocol ]][[ end ]]"
[[- $trusted_proxies := $.traefik.trusted_proxies ]]
[[- if has $def "trusted_proxies" ]]
[[- $trusted_proxies = $def.trusted_proxies ]]
[[- end ]]
[[- if gt (len $trusted_proxies) 0 ]]
proxyProtocol:
trustedIPs:[[ range $idx, $ip := $trusted_proxies ]]
- [[ $ip ]][[ end ]]
[[- end ]]
[[- if has $def "http" ]]
http:
[[ $def.http | toYAML | indent 6 ]]
[[- end ]]
transport:
lifeCycle:
requestAcceptGraceTimeout: 4
[[- if and (has $def "middlewares") (gt (len $def.middlewares)) ]]
middlewares:
[[- range $def.middlewares ]]
- [[ . ]][[ end ]]
[[- end ]]
[[- end ]]
[[- end ]]
api:
dashboard: True
providers:
consulCatalog:
prefix: [[ .instance ]]
endpoint:
address: {{ sockaddr "GetInterfaceIP \"nomad\"" }}:8500
scheme: http
token: {{ with secret "consul/creds/traefik" }}{{ .Data.token }}{{ end }}
exposedByDefault: False
connectAware: True
connectByDefault: True
serviceName: [[ .instance ]]
refreshInterval: 5s
watch: True
file:
directory: /secrets/config
watch: True
[[- if conv.ToBool .prometheus.enabled ]]
metrics:
prometheus:
entryPoint: metrics
[[- end ]]
ping:
manualRouting: True