mirror of
https://github.com/containous/traefik.git
synced 2025-03-19 18:50:12 +03:00
refactor(marathon): template readability.
This commit is contained in:
parent
aeffe1036d
commit
4524cdc151
@ -1,55 +1,71 @@
|
||||
{{$apps := .Applications}}
|
||||
|
||||
[backends]
|
||||
{{range $app := $apps}}
|
||||
{{range $task := $app.Tasks}}
|
||||
{{range $serviceIndex, $serviceName := getServiceNames $app}}
|
||||
|
||||
[backends."{{getBackend $app $serviceName }}"]
|
||||
|
||||
{{ if hasCircuitBreakerLabels $app }}
|
||||
[backends."{{getBackend $app $serviceName }}".circuitBreaker]
|
||||
expression = "{{getCircuitBreakerExpression $app }}"
|
||||
{{end}}
|
||||
|
||||
{{ if hasLoadBalancerLabels $app }}
|
||||
[backends."{{getBackend $app $serviceName }}".loadBalancer]
|
||||
method = "{{getLoadBalancerMethod $app }}"
|
||||
sticky = {{getSticky $app}}
|
||||
{{if hasStickinessLabel $app}}
|
||||
[backends."{{getBackend $app $serviceName }}".loadBalancer.stickiness]
|
||||
cookieName = "{{getStickinessCookieName $app}}"
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{ if hasMaxConnLabels $app }}
|
||||
[backends."{{getBackend $app $serviceName }}".maxConn]
|
||||
amount = {{getMaxConnAmount $app }}
|
||||
extractorFunc = "{{getMaxConnExtractorFunc $app }}"
|
||||
{{end}}
|
||||
|
||||
{{ if hasHealthCheckLabels $app }}
|
||||
[backends."{{getBackend $app $serviceName }}".healthCheck]
|
||||
path = "{{getHealthCheckPath $app }}"
|
||||
interval = "{{getHealthCheckInterval $app }}"
|
||||
{{end}}
|
||||
|
||||
{{end}}
|
||||
|
||||
{{range $task := $app.Tasks}}
|
||||
{{range $serviceIndex, $serviceName := getServiceNames $app}}
|
||||
|
||||
[backends."{{getBackend $app $serviceName}}".servers."server-{{$task.ID | replace "." "-"}}{{getServiceNameSuffix $serviceName }}"]
|
||||
url = "{{getProtocol $app $serviceName}}://{{getBackendServer $task $app}}:{{getPort $task $app $serviceName}}"
|
||||
weight = {{getWeight $app $serviceName}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
url = "{{getProtocol $app $serviceName}}://{{getBackendServer $task $app}}:{{getPort $task $app $serviceName}}"
|
||||
weight = {{getWeight $app $serviceName}}
|
||||
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{end}}
|
||||
|
||||
[frontends]
|
||||
{{range $app := $apps}}
|
||||
{{range $serviceIndex, $serviceName := getServiceNames $app}}
|
||||
[backends."{{getBackend $app $serviceName }}"]
|
||||
{{ if hasMaxConnLabels $app }}
|
||||
[backends."{{getBackend $app $serviceName }}".maxconn]
|
||||
amount = {{getMaxConnAmount $app }}
|
||||
extractorfunc = "{{getMaxConnExtractorFunc $app }}"
|
||||
{{end}}
|
||||
{{ if hasLoadBalancerLabels $app }}
|
||||
[backends."{{getBackend $app $serviceName }}".loadbalancer]
|
||||
method = "{{getLoadBalancerMethod $app }}"
|
||||
sticky = {{getSticky $app}}
|
||||
{{if hasStickinessLabel $app}}
|
||||
[backends."{{getBackend $app $serviceName }}".loadbalancer.stickiness]
|
||||
cookieName = "{{getStickinessCookieName $app}}"
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ if hasCircuitBreakerLabels $app }}
|
||||
[backends."{{getBackend $app $serviceName }}".circuitbreaker]
|
||||
expression = "{{getCircuitBreakerExpression $app }}"
|
||||
{{end}}
|
||||
{{ if hasHealthCheckLabels $app }}
|
||||
[backends."{{getBackend $app $serviceName }}".healthcheck]
|
||||
path = "{{getHealthCheckPath $app }}"
|
||||
interval = "{{getHealthCheckInterval $app }}"
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{range $serviceIndex, $serviceName := getServiceNames .}}
|
||||
|
||||
[frontends]{{range $app := $apps}}{{range $serviceIndex, $serviceName := getServiceNames .}}
|
||||
[frontends."{{ getFrontendName $app $serviceName }}"]
|
||||
backend = "{{getBackend $app $serviceName}}"
|
||||
passHostHeader = {{getPassHostHeader $app $serviceName}}
|
||||
priority = {{getPriority $app $serviceName}}
|
||||
entryPoints = [{{range getEntryPoints $app $serviceName}}
|
||||
"{{.}}",
|
||||
{{end}}]
|
||||
basicAuth = [{{range getBasicAuth $app $serviceName}}
|
||||
"{{.}}",
|
||||
{{end}}]
|
||||
backend = "{{getBackend $app $serviceName}}"
|
||||
priority = {{getPriority $app $serviceName}}
|
||||
passHostHeader = {{getPassHostHeader $app $serviceName}}
|
||||
|
||||
entryPoints = [{{range getEntryPoints $app $serviceName}}
|
||||
"{{.}}",
|
||||
{{end}}]
|
||||
|
||||
basicAuth = [{{range getBasicAuth $app $serviceName}}
|
||||
"{{.}}",
|
||||
{{end}}]
|
||||
|
||||
[frontends."{{ getFrontendName $app $serviceName }}".routes."route-host{{$app.ID | replace "/" "-"}}{{getServiceNameSuffix $serviceName }}"]
|
||||
rule = "{{getFrontendRule $app $serviceName}}"
|
||||
{{end}}{{end}}
|
||||
rule = "{{getFrontendRule $app $serviceName}}"
|
||||
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user