2016-09-28 16:29:19 +02:00
|
|
|
{{$backendServers := .Servers}}
|
|
|
|
[backends]{{range $backendName, $backend := .Backends}}
|
|
|
|
{{if hasCircuitBreakerLabel $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.circuitbreaker]
|
|
|
|
expression = "{{getCircuitBreakerExpression $backend}}"
|
2016-08-25 00:22:06 -04:00
|
|
|
{{end}}
|
|
|
|
|
2016-09-28 16:29:19 +02:00
|
|
|
{{if hasLoadBalancerLabel $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.loadbalancer]
|
|
|
|
method = "{{getLoadBalancerMethod $backend}}"
|
2017-10-16 17:38:03 +02:00
|
|
|
sticky = {{getSticky $backend}}
|
2017-10-10 11:10:02 +02:00
|
|
|
{{if hasStickinessLabel $backend}}
|
2017-10-16 17:38:03 +02:00
|
|
|
[backends.backend-{{$backendName}}.loadBalancer.stickiness]
|
2017-10-12 17:50:03 +02:00
|
|
|
cookieName = "{{getStickinessCookieName $backend}}"
|
2017-10-10 11:10:02 +02:00
|
|
|
{{end}}
|
2016-08-25 00:22:06 -04:00
|
|
|
{{end}}
|
|
|
|
|
2016-09-28 16:29:19 +02:00
|
|
|
{{if hasMaxConnLabels $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.maxconn]
|
|
|
|
amount = {{getMaxConnAmount $backend}}
|
|
|
|
extractorfunc = "{{getMaxConnExtractorFunc $backend}}"
|
2016-08-25 00:22:06 -04:00
|
|
|
{{end}}
|
2016-09-28 16:29:19 +02:00
|
|
|
|
|
|
|
{{$servers := index $backendServers $backendName}}
|
|
|
|
{{range $serverName, $server := $servers}}
|
2017-03-08 15:10:21 +01:00
|
|
|
{{if hasServices $server}}
|
|
|
|
{{$services := getServiceNames $server}}
|
|
|
|
{{range $serviceIndex, $serviceName := $services}}
|
2017-10-25 10:00:03 +02:00
|
|
|
[backends.backend-{{getServiceBackend $server $serviceName}}.servers.service-{{$serverName}}]
|
2017-03-08 15:10:21 +01:00
|
|
|
url = "{{getServiceProtocol $server $serviceName}}://{{getIPAddress $server}}:{{getServicePort $server $serviceName}}"
|
|
|
|
weight = {{getServiceWeight $server $serviceName}}
|
|
|
|
{{end}}
|
|
|
|
{{else}}
|
2016-09-28 16:29:19 +02:00
|
|
|
[backends.backend-{{$backendName}}.servers.server-{{$server.Name | replace "/" "" | replace "." "-"}}]
|
|
|
|
url = "{{getProtocol $server}}://{{getIPAddress $server}}:{{getPort $server}}"
|
|
|
|
weight = {{getWeight $server}}
|
|
|
|
{{end}}
|
2017-03-08 15:10:21 +01:00
|
|
|
{{end}}
|
2016-09-28 16:29:19 +02:00
|
|
|
|
2016-09-28 13:28:20 +02:00
|
|
|
{{end}}
|
2015-09-02 21:13:25 +02:00
|
|
|
|
2015-10-23 09:49:19 +02:00
|
|
|
[frontends]{{range $frontend, $containers := .Frontends}}
|
2017-03-08 15:10:21 +01: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 11:22:07 +02:00
|
|
|
{{if getWhitelistSourceRange $container}}
|
|
|
|
whitelistSourceRange = [{{range getWhitelistSourceRange $container}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
2017-03-08 15:10:21 +01:00
|
|
|
priority = {{getServicePriority $container $serviceName}}
|
|
|
|
entryPoints = [{{range getServiceEntryPoints $container $serviceName}}
|
|
|
|
"{{.}}",
|
2017-04-19 11:14:05 +02:00
|
|
|
{{end}}]
|
|
|
|
basicAuth = [{{range getServiceBasicAuth $container $serviceName}}
|
|
|
|
"{{.}}",
|
2017-03-08 15:10:21 +01:00
|
|
|
{{end}}]
|
2017-12-15 11:48:03 +01:00
|
|
|
|
|
|
|
{{if hasServiceRedirect $container $serviceName}}
|
|
|
|
[frontends."frontend-{{getServiceBackend $container $serviceName}}".redirect]
|
|
|
|
entryPoint = "{{getServiceRedirectEntryPoint $container $serviceName}}"
|
|
|
|
regex = "{{getServiceRedirectRegex $container $serviceName}}"
|
|
|
|
replacement = "{{getServiceRedirectReplacement $container $serviceName}}"
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
[frontends."frontend-{{getServiceBackend $container $serviceName}}".routes."service-{{$serviceName | replace "/" "" | replace "." "-"}}"]
|
2017-03-08 15:10:21 +01:00
|
|
|
rule = "{{getServiceFrontendRule $container $serviceName}}"
|
|
|
|
{{end}}
|
|
|
|
{{else}}
|
|
|
|
[frontends."frontend-{{$frontend}}"]
|
2015-09-09 17:41:33 +02:00
|
|
|
backend = "backend-{{getBackend $container}}"
|
2015-10-30 11:33:41 +01:00
|
|
|
passHostHeader = {{getPassHostHeader $container}}
|
2017-04-30 11:22:07 +02:00
|
|
|
{{if getWhitelistSourceRange $container}}
|
|
|
|
whitelistSourceRange = [{{range getWhitelistSourceRange $container}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
2016-06-06 22:30:23 +02:00
|
|
|
priority = {{getPriority $container}}
|
2016-02-01 16:08:58 +01:00
|
|
|
entryPoints = [{{range getEntryPoints $container}}
|
|
|
|
"{{.}}",
|
2017-04-19 11:14:05 +02:00
|
|
|
{{end}}]
|
|
|
|
basicAuth = [{{range getBasicAuth $container}}
|
|
|
|
"{{.}}",
|
2016-02-01 16:08:58 +01:00
|
|
|
{{end}}]
|
2017-12-15 11:48:03 +01:00
|
|
|
|
|
|
|
{{if hasRedirect $container}}
|
|
|
|
[frontends."frontend-{{$frontend}}".redirect]
|
|
|
|
entryPoint = "{{getRedirectEntryPoint $container}}"
|
|
|
|
regex = "{{getRedirectRegex $container}}"
|
|
|
|
replacement = "{{getRedirectReplacement $container}}"
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-02 10:10:04 +01:00
|
|
|
{{ if hasHeaders $container}}
|
2017-11-22 12:40:04 -06:00
|
|
|
[frontends."frontend-{{$frontend}}".headers]
|
|
|
|
{{if hasSSLRedirectHeaders $container}}
|
|
|
|
SSLRedirect = {{getSSLRedirectHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasSSLTemporaryRedirectHeaders $container}}
|
|
|
|
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasSSLHostHeaders $container}}
|
2017-11-30 03:42:02 -06:00
|
|
|
SSLHost = "{{getSSLHostHeaders $container}}"
|
2017-11-22 12:40:04 -06:00
|
|
|
{{end}}
|
|
|
|
{{if hasSTSSecondsHeaders $container}}
|
|
|
|
STSSeconds = {{getSTSSecondsHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasSTSIncludeSubdomainsHeaders $container}}
|
|
|
|
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasSTSPreloadHeaders $container}}
|
|
|
|
STSPreload = {{getSTSPreloadHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasForceSTSHeaderHeaders $container}}
|
|
|
|
ForceSTSHeader = {{getForceSTSHeaderHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasFrameDenyHeaders $container}}
|
|
|
|
FrameDeny = {{getFrameDenyHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasCustomFrameOptionsValueHeaders $container}}
|
2017-11-30 03:42:02 -06:00
|
|
|
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders $container}}"
|
2017-11-22 12:40:04 -06:00
|
|
|
{{end}}
|
|
|
|
{{if hasContentTypeNosniffHeaders $container}}
|
|
|
|
ContentTypeNosniff = {{getContentTypeNosniffHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasBrowserXSSFilterHeaders $container}}
|
|
|
|
BrowserXSSFilter = {{getBrowserXSSFilterHeaders $container}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasContentSecurityPolicyHeaders $container}}
|
2017-11-30 03:42:02 -06:00
|
|
|
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders $container}}"
|
2017-11-22 12:40:04 -06:00
|
|
|
{{end}}
|
|
|
|
{{if hasPublicKeyHeaders $container}}
|
2017-11-30 03:42:02 -06:00
|
|
|
PublicKey = "{{getPublicKeyHeaders $container}}"
|
2017-11-22 12:40:04 -06:00
|
|
|
{{end}}
|
|
|
|
{{if hasReferrerPolicyHeaders $container}}
|
2017-11-30 03:42:02 -06:00
|
|
|
ReferrerPolicy = "{{getReferrerPolicyHeaders $container}}"
|
2017-11-22 12:40:04 -06:00
|
|
|
{{end}}
|
|
|
|
{{if hasIsDevelopmentHeaders $container}}
|
|
|
|
IsDevelopment = {{getIsDevelopmentHeaders $container}}
|
|
|
|
{{end}}
|
2018-01-02 10:10:04 +01:00
|
|
|
{{if hasAllowedHostsHeaders $container}}
|
|
|
|
AllowedHosts = [{{range getAllowedHostsHeaders $container}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
|
|
|
{{if hasHostsProxyHeaders $container}}
|
|
|
|
HostsProxyHeaders = [{{range getHostsProxyHeaders $container}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
2017-10-20 10:14:03 -05:00
|
|
|
{{if hasRequestHeaders $container}}
|
|
|
|
[frontends."frontend-{{$frontend}}".headers.customrequestheaders]
|
|
|
|
{{range $k, $v := getRequestHeaders $container}}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{if hasResponseHeaders $container}}
|
|
|
|
[frontends."frontend-{{$frontend}}".headers.customresponseheaders]
|
|
|
|
{{range $k, $v := getResponseHeaders $container}}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
2017-11-22 12:40:04 -06:00
|
|
|
{{end}}
|
|
|
|
{{if hasSSLProxyHeaders $container}}
|
|
|
|
[frontends."frontend-{{$frontend}}".headers.SSLProxyHeaders]
|
|
|
|
{{range $k, $v := getSSLProxyHeaders $container}}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
2017-10-20 10:14:03 -05:00
|
|
|
{{end}}
|
2018-01-02 10:10:04 +01:00
|
|
|
{{end}}
|
|
|
|
|
2015-10-23 09:49:19 +02:00
|
|
|
[frontends."frontend-{{$frontend}}".routes."route-frontend-{{$frontend}}"]
|
|
|
|
rule = "{{getFrontendRule $container}}"
|
2017-03-08 15:10:21 +01:00
|
|
|
{{end}}
|
2015-10-23 18:59:08 +02:00
|
|
|
{{end}}
|