traefik/templates/ecs.tmpl
2018-01-03 23:52:03 +01:00

50 lines
No EOL
1.5 KiB
Cheetah

[backends]
{{range $serviceName, $instances := .Services}}
{{if hasLoadBalancerLabel $instances}}
[backends.backend-{{ $serviceName }}.loadBalancer]
method = "{{ getLoadBalancerMethod $instances}}"
sticky = {{ getSticky $instances}}
{{if hasStickinessLabel $instances}}
[backends.backend-{{ $serviceName }}.loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $instances}}"
{{end}}
{{end}}
{{ if hasHealthCheckLabels $instances }}
[backends.backend-{{ $serviceName }}.healthCheck]
path = "{{getHealthCheckPath $instances }}"
port = {{getHealthCheckPort $instances}}
interval = "{{getHealthCheckInterval $instances }}"
{{end}}
{{range $index, $instance := $instances}}
[backends.backend-{{ $instance.Name }}.servers.server-{{ $instance.Name }}{{ $instance.ID }}]
url = "{{ getProtocol $instance }}://{{ getHost $instance }}:{{ getPort $instance }}"
weight = {{ getWeight $instance}}
{{end}}
{{end}}
[frontends]
{{range $serviceName, $instances := .Services}}
{{range filterFrontends $instances}}
[frontends.frontend-{{ $serviceName }}]
backend = "backend-{{ $serviceName }}"
priority = {{ getPriority .}}
passHostHeader = {{ getPassHostHeader .}}
entryPoints = [{{range getEntryPoints .}}
"{{.}}",
{{end}}]
basicAuth = [{{range getBasicAuth .}}
"{{.}}",
{{end}}]
[frontends.frontend-{{ $serviceName }}.routes.route-frontend-{{ $serviceName }}]
rule = "{{getFrontendRule .}}"
{{end}}
{{end}}