2016-09-28 14:29:19 +00:00
|
|
|
{{$backendServers := .Servers}}
|
|
|
|
[backends]{{range $backendName, $backend := .Backends}}
|
|
|
|
{{if hasCircuitBreakerLabel $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.circuitbreaker]
|
|
|
|
expression = "{{getCircuitBreakerExpression $backend}}"
|
2016-08-25 04:22:06 +00:00
|
|
|
{{end}}
|
|
|
|
|
2016-09-28 14:29:19 +00:00
|
|
|
{{if hasLoadBalancerLabel $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.loadbalancer]
|
|
|
|
method = "{{getLoadBalancerMethod $backend}}"
|
2017-10-16 15:38:03 +00:00
|
|
|
sticky = {{getSticky $backend}}
|
2017-10-10 09:10:02 +00:00
|
|
|
{{if hasStickinessLabel $backend}}
|
2017-10-16 15:38:03 +00:00
|
|
|
[backends.backend-{{$backendName}}.loadBalancer.stickiness]
|
2017-10-12 15:50:03 +00:00
|
|
|
cookieName = "{{getStickinessCookieName $backend}}"
|
2017-10-10 09:10:02 +00:00
|
|
|
{{end}}
|
2016-08-25 04:22:06 +00:00
|
|
|
{{end}}
|
|
|
|
|
2016-09-28 14:29:19 +00:00
|
|
|
{{if hasMaxConnLabels $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.maxconn]
|
|
|
|
amount = {{getMaxConnAmount $backend}}
|
|
|
|
extractorfunc = "{{getMaxConnExtractorFunc $backend}}"
|
2016-08-25 04:22:06 +00:00
|
|
|
{{end}}
|
2016-09-28 14:29:19 +00:00
|
|
|
|
|
|
|
{{$servers := index $backendServers $backendName}}
|
|
|
|
{{range $serverName, $server := $servers}}
|
2017-03-08 14:10:21 +00:00
|
|
|
{{if hasServices $server}}
|
|
|
|
{{$services := getServiceNames $server}}
|
|
|
|
{{range $serviceIndex, $serviceName := $services}}
|
|
|
|
[backends.backend-{{getServiceBackend $server $serviceName}}.servers.service]
|
|
|
|
url = "{{getServiceProtocol $server $serviceName}}://{{getIPAddress $server}}:{{getServicePort $server $serviceName}}"
|
|
|
|
weight = {{getServiceWeight $server $serviceName}}
|
|
|
|
{{end}}
|
|
|
|
{{else}}
|
2016-09-28 14:29:19 +00:00
|
|
|
[backends.backend-{{$backendName}}.servers.server-{{$server.Name | replace "/" "" | replace "." "-"}}]
|
|
|
|
url = "{{getProtocol $server}}://{{getIPAddress $server}}:{{getPort $server}}"
|
|
|
|
weight = {{getWeight $server}}
|
|
|
|
{{end}}
|
2017-03-08 14:10:21 +00:00
|
|
|
{{end}}
|
2016-09-28 14:29:19 +00:00
|
|
|
|
2016-09-28 11:28:20 +00:00
|
|
|
{{end}}
|
2015-09-02 19:13:25 +00:00
|
|
|
|
2015-10-23 07:49:19 +00:00
|
|
|
[frontends]{{range $frontend, $containers := .Frontends}}
|
2017-03-08 14:10:21 +00:00
|
|
|
{{$container := index $containers 0}}
|
|
|
|
{{if hasServices $container}}
|
|
|
|
{{$services := getServiceNames $container}}
|
|
|
|
{{range $serviceIndex, $serviceName := $services}}
|
|
|
|
[frontends."frontend-{{getServiceBackend $container $serviceName}}"]
|
|
|
|
backend = "backend-{{getServiceBackend $container $serviceName}}"
|
|
|
|
passHostHeader = {{getServicePassHostHeader $container $serviceName}}
|
2017-04-30 09:22:07 +00:00
|
|
|
{{if getWhitelistSourceRange $container}}
|
|
|
|
whitelistSourceRange = [{{range getWhitelistSourceRange $container}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
2017-03-08 14:10:21 +00:00
|
|
|
priority = {{getServicePriority $container $serviceName}}
|
|
|
|
entryPoints = [{{range getServiceEntryPoints $container $serviceName}}
|
|
|
|
"{{.}}",
|
2017-04-19 09:14:05 +00:00
|
|
|
{{end}}]
|
|
|
|
basicAuth = [{{range getServiceBasicAuth $container $serviceName}}
|
|
|
|
"{{.}}",
|
2017-03-08 14:10:21 +00:00
|
|
|
{{end}}]
|
|
|
|
[frontends."frontend-{{getServiceBackend $container $serviceName}}".routes."service-{{$serviceName | replace "/" "" | replace "." "-"}}"]
|
|
|
|
rule = "{{getServiceFrontendRule $container $serviceName}}"
|
|
|
|
{{end}}
|
|
|
|
{{else}}
|
|
|
|
[frontends."frontend-{{$frontend}}"]
|
2015-09-09 15:41:33 +00:00
|
|
|
backend = "backend-{{getBackend $container}}"
|
2015-10-30 10:33:41 +00:00
|
|
|
passHostHeader = {{getPassHostHeader $container}}
|
2017-04-30 09:22:07 +00:00
|
|
|
{{if getWhitelistSourceRange $container}}
|
|
|
|
whitelistSourceRange = [{{range getWhitelistSourceRange $container}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
2016-06-06 20:30:23 +00:00
|
|
|
priority = {{getPriority $container}}
|
2016-02-01 15:08:58 +00:00
|
|
|
entryPoints = [{{range getEntryPoints $container}}
|
|
|
|
"{{.}}",
|
2017-04-19 09:14:05 +00:00
|
|
|
{{end}}]
|
|
|
|
basicAuth = [{{range getBasicAuth $container}}
|
|
|
|
"{{.}}",
|
2016-02-01 15:08:58 +00:00
|
|
|
{{end}}]
|
2015-10-23 07:49:19 +00:00
|
|
|
[frontends."frontend-{{$frontend}}".routes."route-frontend-{{$frontend}}"]
|
|
|
|
rule = "{{getFrontendRule $container}}"
|
2017-03-08 14:10:21 +00:00
|
|
|
{{end}}
|
2015-10-23 16:59:08 +00:00
|
|
|
{{end}}
|