traefik/templates/marathon.tmpl
Timo Reimann d57f83c31c Make Traefik health checks label-configurable with Marathon.
For the two existing health check parameters (path and interval), we add
support for Marathon labels.

Changes in detail:

- Extend the Marathon provider and template.
- Refactor Server.loadConfig to reduce duplication.
- Refactor the healthcheck package slightly to accommodate the changes
  and allow extending by future parameters.
- Update documentation.
2017-04-28 18:17:25 +02:00

40 lines
1.4 KiB
Cheetah

{{$apps := .Applications}}
[backends]{{range .Tasks}}
[backends."backend{{getBackend . $apps}}".servers."server-{{.ID | replace "." "-"}}"]
url = "{{getProtocol . $apps}}://{{getBackendServer . $apps}}:{{getPort . $apps}}"
weight = {{getWeight . $apps}}
{{end}}
{{range .Applications}}
{{ if hasMaxConnLabels . }}
[backends."backend{{getFrontendBackend . }}".maxconn]
amount = {{getMaxConnAmount . }}
extractorfunc = "{{getMaxConnExtractorFunc . }}"
{{end}}
{{ if hasLoadBalancerLabels . }}
[backends."backend{{getFrontendBackend . }}".loadbalancer]
method = "{{getLoadBalancerMethod . }}"
sticky = {{getSticky .}}
{{end}}
{{ if hasCircuitBreakerLabels . }}
[backends."backend{{getFrontendBackend . }}".circuitbreaker]
expression = "{{getCircuitBreakerExpression . }}"
{{end}}
{{ if hasHealthCheckLabels . }}
[backends."backend{{getFrontendBackend . }}".healthcheck]
path = "{{getHealthCheckPath . }}"
interval = "{{getHealthCheckInterval . }}"
{{end}}
{{end}}
[frontends]{{range .Applications}}
[frontends."frontend{{.ID | replace "/" "-"}}"]
backend = "backend{{getFrontendBackend .}}"
passHostHeader = {{getPassHostHeader .}}
priority = {{getPriority .}}
entryPoints = [{{range getEntryPoints .}}
"{{.}}",
{{end}}]
[frontends."frontend{{.ID | replace "/" "-"}}".routes."route-host{{.ID | replace "/" "-"}}"]
rule = "{{getFrontendRule .}}"
{{end}}