traefik/templates/ecs.tmpl

176 lines
6.3 KiB
Cheetah
Raw Normal View History

2017-12-16 18:22:16 +00:00
[backends]
{{range $serviceName, $instances := .Services}}
2017-12-16 18:51:39 +00:00
{{if hasCircuitBreakerLabel $instances}}
[backends.backend-{{ $serviceName }}.circuitBreaker]
expression = "{{getCircuitBreakerExpression $instances}}"
{{end}}
{{if hasLoadBalancerLabel $instances}}
2017-12-16 18:22:16 +00:00
[backends.backend-{{ $serviceName }}.loadBalancer]
2017-08-25 09:42:03 +00:00
method = "{{ getLoadBalancerMethod $instances}}"
sticky = {{ getSticky $instances}}
2017-12-16 18:22:16 +00:00
{{if hasStickinessLabel $instances}}
[backends.backend-{{ $serviceName }}.loadBalancer.stickiness]
2017-10-12 15:50:03 +00:00
cookieName = "{{getStickinessCookieName $instances}}"
2017-10-10 09:10:02 +00:00
{{end}}
{{end}}
2017-01-05 14:24:17 +00:00
2017-12-16 18:57:40 +00:00
{{if hasMaxConnLabels $instances}}
[backends.backend-{{ $serviceName }}.maxConn]
amount = {{getMaxConnAmount $instances}}
extractorFunc = "{{getMaxConnExtractorFunc $instances}}"
{{end}}
2017-12-16 18:22:16 +00:00
{{ if hasHealthCheckLabels $instances }}
[backends.backend-{{ $serviceName }}.healthCheck]
path = "{{getHealthCheckPath $instances }}"
2017-12-16 18:29:30 +00:00
port = {{getHealthCheckPort $instances}}
2017-12-16 18:22:16 +00:00
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}}
2017-08-25 09:42:03 +00:00
{{end}}
2017-12-16 18:22:16 +00:00
2017-01-05 14:24:17 +00:00
{{end}}
2017-08-25 09:42:03 +00:00
2017-12-16 18:22:16 +00:00
[frontends]
{{range $serviceName, $instances := .Services}}
{{range $instance := filterFrontends $instances}}
2017-12-16 18:22:16 +00:00
[frontends.frontend-{{ $serviceName }}]
backend = "backend-{{ $serviceName }}"
priority = {{ getPriority $instance}}
passHostHeader = {{ getPassHostHeader $instance}}
passTLSCert = {{ getPassTLSCert $instance}}
2017-12-16 18:22:16 +00:00
entryPoints = [{{range getEntryPoints $instance}}
2017-08-25 09:42:03 +00:00
"{{.}}",
2017-12-16 18:22:16 +00:00
{{end}}]
{{if getWhitelistSourceRange $instance}}
whitelistSourceRange = [{{range getWhitelistSourceRange $instance}}
"{{.}}",
{{end}}]
{{end}}
basicAuth = [{{range getBasicAuth $instance}}
2017-09-07 15:34:03 +00:00
"{{.}}",
2017-12-16 18:22:16 +00:00
{{end}}]
{{if hasRedirect $instance}}
[frontends."frontend-{{ $serviceName }}".redirect]
entryPoint = "{{getRedirectEntryPoint $instance}}"
regex = "{{getRedirectRegex $instance}}"
replacement = "{{getRedirectReplacement $instance}}"
{{end}}
{{ if hasErrorPages $instance }}
[frontends."frontend-{{ $serviceName }}".errors]
{{ range $pageName, $page := getErrorPages $instance }}
[frontends."frontend-{{ $serviceName }}".errors.{{ $pageName }}]
status = [{{range $page.Status}}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ if hasRateLimits $instance }}
[frontends."frontend-{{ $serviceName }}".rateLimit]
extractorFunc = "{{ getRateLimitsExtractorFunc $instance }}"
[frontends."frontend-{{ $serviceName }}".rateLimit.rateSet]
{{ range $limitName, $rateLimit := getRateLimits $instance }}
[frontends."frontend-{{ $serviceName }}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers]
{{if hasSSLRedirectHeaders $instance}}
SSLRedirect = {{getSSLRedirectHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasSSLTemporaryRedirectHeaders $instance}}
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasSSLHostHeaders $instance}}
SSLHost = "{{getSSLHostHeaders $instance}}"
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasSTSSecondsHeaders $instance}}
STSSeconds = {{getSTSSecondsHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasSTSIncludeSubdomainsHeaders $instance}}
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasSTSPreloadHeaders $instance}}
STSPreload = {{getSTSPreloadHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasForceSTSHeaderHeaders $instance}}
ForceSTSHeader = {{getForceSTSHeaderHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasFrameDenyHeaders $instance}}
FrameDeny = {{getFrameDenyHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasCustomFrameOptionsValueHeaders $instance}}
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders $instance}}"
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasContentTypeNosniffHeaders $instance}}
ContentTypeNosniff = {{getContentTypeNosniffHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasBrowserXSSFilterHeaders $instance}}
BrowserXSSFilter = {{getBrowserXSSFilterHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasContentSecurityPolicyHeaders $instance}}
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders $instance}}"
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasPublicKeyHeaders $instance}}
PublicKey = "{{getPublicKeyHeaders $instance}}"
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasReferrerPolicyHeaders $instance}}
ReferrerPolicy = "{{getReferrerPolicyHeaders $instance}}"
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasIsDevelopmentHeaders $instance}}
IsDevelopment = {{getIsDevelopmentHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{end}}
{{if hasRequestHeaders $instance}}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers.customRequestHeaders]
{{range $k, $v := getRequestHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasResponseHeaders $instance}}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers.customResponseHeaders]
{{range $k, $v := getResponseHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
{{if hasAllowedHostsHeaders $instance}}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers.AllowedHosts]
{{range getAllowedHostsHeaders $instance}}
2017-12-16 19:24:30 +00:00
"{{.}}"
{{end}}
{{end}}
{{if hasHostsProxyHeaders $instance}}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers.HostsProxyHeaders]
{{range getHostsProxyHeaders $instance}}
2017-12-16 19:24:30 +00:00
"{{.}}"
{{end}}
{{end}}
{{if hasSSLProxyHeaders $instance}}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers.SSLProxyHeaders]
{{range $k, $v := getSSLProxyHeaders $instance}}
2017-12-16 19:24:30 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-08-25 09:42:03 +00:00
[frontends.frontend-{{ $serviceName }}.routes.route-frontend-{{ $serviceName }}]
rule = "{{getFrontendRule $instance}}"
2017-12-16 18:22:16 +00:00
{{end}}
2017-08-25 09:42:03 +00:00
{{end}}