traefik/templates/rancher.tmpl
2018-01-03 23:26:03 +01:00

151 lines
5.2 KiB
Cheetah

{{$backendServers := .Backends}}
[backends]
{{range $backendName, $backend := .Backends}}
{{if hasCircuitBreakerLabel $backend}}
[backends.backend-{{$backendName}}.circuitBreaker]
expression = "{{getCircuitBreakerExpression $backend}}"
{{end}}
{{if hasLoadBalancerLabel $backend}}
[backends.backend-{{$backendName}}.loadBalancer]
method = "{{getLoadBalancerMethod $backend}}"
sticky = {{getSticky $backend}}
{{if hasStickinessLabel $backend}}
[backends.backend-{{$backendName}}.loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $backend}}"
{{end}}
{{end}}
{{if hasMaxConnLabels $backend}}
[backends.backend-{{$backendName}}.maxConn]
amount = {{getMaxConnAmount $backend}}
extractorFunc = "{{getMaxConnExtractorFunc $backend}}"
{{end}}
{{if hasHealthCheckLabels $backend}}
[backends.backend-{{$backendName}}.healthCheck]
path = "{{getHealthCheckPath $backend}}"
port = {{getHealthCheckPort $backend}}
interval = "{{getHealthCheckInterval $backend}}"
{{end}}
{{range $index, $ip := $backend.Containers}}
[backends.backend-{{$backendName}}.servers.server-{{$index}}]
url = "{{getProtocol $backend}}://{{$ip}}:{{getPort $backend}}"
weight = {{getWeight $backend}}
{{end}}
{{end}}
[frontends]
{{range $frontendName, $service := .Frontends}}
[frontends."frontend-{{$frontendName}}"]
backend = "backend-{{getBackend $service}}"
priority = {{getPriority $service}}
passHostHeader = {{getPassHostHeader $service}}
passTLSCert = {{getPassTLSCert $service}}
entryPoints = [{{range getEntryPoints $service}}
"{{.}}",
{{end}}]
{{if getWhitelistSourceRange $service}}
whitelistSourceRange = [{{range getWhitelistSourceRange $service}}
"{{.}}",
{{end}}]
{{end}}
basicAuth = [{{range getBasicAuth $service}}
"{{.}}",
{{end}}]
{{if hasRedirect $service}}
[frontends."frontend-{{$frontendName}}".redirect]
entryPoint = "{{getRedirectEntryPoint $service}}"
regex = "{{getRedirectRegex $service}}"
replacement = "{{getRedirectReplacement $service}}"
{{end}}
[frontends."frontend-{{$frontendName}}".headers]
{{if hasSSLRedirectHeaders $service}}
SSLRedirect = {{getSSLRedirectHeaders $service}}
{{end}}
{{if hasSSLTemporaryRedirectHeaders $service}}
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders $service}}
{{end}}
{{if hasSSLHostHeaders $service}}
SSLHost = "{{getSSLHostHeaders $service}}"
{{end}}
{{if hasSTSSecondsHeaders $service}}
STSSeconds = {{getSTSSecondsHeaders $service}}
{{end}}
{{if hasSTSIncludeSubdomainsHeaders $service}}
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders $service}}
{{end}}
{{if hasSTSPreloadHeaders $service}}
STSPreload = {{getSTSPreloadHeaders $service}}
{{end}}
{{if hasForceSTSHeaderHeaders $service}}
ForceSTSHeader = {{getForceSTSHeaderHeaders $service}}
{{end}}
{{if hasFrameDenyHeaders $service}}
FrameDeny = {{getFrameDenyHeaders $service}}
{{end}}
{{if hasCustomFrameOptionsValueHeaders $service}}
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders $service}}"
{{end}}
{{if hasContentTypeNosniffHeaders $service}}
ContentTypeNosniff = {{getContentTypeNosniffHeaders $service}}
{{end}}
{{if hasBrowserXSSFilterHeaders $service}}
BrowserXSSFilter = {{getBrowserXSSFilterHeaders $service}}
{{end}}
{{if hasContentSecurityPolicyHeaders $service}}
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders $service}}"
{{end}}
{{if hasPublicKeyHeaders $service}}
PublicKey = "{{getPublicKeyHeaders $service}}"
{{end}}
{{if hasReferrerPolicyHeaders $service}}
ReferrerPolicy = "{{getReferrerPolicyHeaders $service}}"
{{end}}
{{if hasIsDevelopmentHeaders $service}}
IsDevelopment = {{getIsDevelopmentHeaders $service}}
{{end}}
{{if hasRequestHeaders $service}}
[frontends."frontend-{{$frontendName}}".headers.customRequestHeaders]
{{range $k, $v := getRequestHeaders $service}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasResponseHeaders $service}}
[frontends."frontend-{{$frontendName}}".headers.customResponseHeaders]
{{range $k, $v := getResponseHeaders $service}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasAllowedHostsHeaders $service}}
[frontends."frontend-{{$frontendName}}".headers.AllowedHosts]
{{range getAllowedHostsHeaders $service}}
"{{.}}"
{{end}}
{{end}}
{{if hasHostsProxyHeaders $service}}
[frontends."frontend-{{$frontendName}}".headers.HostsProxyHeaders]
{{range getHostsProxyHeaders $service}}
"{{.}}"
{{end}}
{{end}}
{{if hasSSLProxyHeaders $service}}
[frontends."frontend-{{$frontendName}}".headers.SSLProxyHeaders]
{{range $k, $v := getSSLProxyHeaders $service}}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
[frontends."frontend-{{$frontendName}}".routes."route-frontend-{{$frontendName}}"]
rule = "{{getFrontendRule $service}}"
{{end}}