traefik/templates/ecs.tmpl

175 lines
6.2 KiB
Cheetah
Raw Normal View History

2017-12-16 18:22:16 +00:00
[backends]
2018-01-10 17:28:03 +00:00
{{range $serviceName, $instances := .Services }}
{{ $firstInstance := index $instances 0 }}
2017-12-16 18:22:16 +00:00
2018-03-28 00:13:48 +00:00
{{ $circuitBreaker := getCircuitBreaker $firstInstance.TraefikLabels }}
2018-01-10 17:28:03 +00:00
{{if $circuitBreaker }}
[backends."backend-{{ $serviceName }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
2017-12-16 18:51:39 +00:00
{{end}}
2018-03-28 00:13:48 +00:00
{{ $loadBalancer := getLoadBalancer $firstInstance.TraefikLabels }}
2018-01-10 17:28:03 +00:00
{{if $loadBalancer }}
[backends."backend-{{ $serviceName }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
sticky = {{ $loadBalancer.Sticky }}
{{if $loadBalancer.Stickiness }}
[backends."backend-{{ $serviceName }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
2017-10-10 09:10:02 +00:00
{{end}}
{{end}}
2017-01-05 14:24:17 +00:00
2018-03-28 00:13:48 +00:00
{{ $maxConn := getMaxConn $firstInstance.TraefikLabels }}
2018-01-10 17:28:03 +00:00
{{if $maxConn }}
[backends."backend-{{ $serviceName }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2017-12-16 18:57:40 +00:00
{{end}}
2018-03-28 00:13:48 +00:00
{{ $healthCheck := getHealthCheck $firstInstance.TraefikLabels }}
2018-01-10 17:28:03 +00:00
{{if $healthCheck }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $serviceName }}".healthCheck]
2018-01-10 17:28:03 +00:00
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2017-12-16 18:22:16 +00:00
{{end}}
2018-03-28 00:13:48 +00:00
{{ $buffering := getBuffering $firstInstance.TraefikLabels }}
2018-01-31 14:32:04 +00:00
{{if $buffering }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $serviceName }}".buffering]
2018-01-31 14:32:04 +00:00
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
2018-01-10 17:28:03 +00:00
{{range $serverName, $server := getServers $instances }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $serviceName }}".servers."{{ $serverName }}"]
2018-01-10 17:28:03 +00:00
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
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]
2018-01-10 17:28:03 +00:00
{{range $serviceName, $instances := .Services }}
{{range $instance := filterFrontends $instances }}
2017-12-16 18:22:16 +00:00
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $serviceName }}"]
2017-12-16 18:22:16 +00:00
backend = "backend-{{ $serviceName }}"
2018-03-28 00:13:48 +00:00
priority = {{ getPriority $instance.TraefikLabels }}
passHostHeader = {{ getPassHostHeader $instance.TraefikLabels }}
passTLSCert = {{ getPassTLSCert $instance.TraefikLabels }}
2017-12-16 18:22:16 +00:00
2018-03-28 00:13:48 +00:00
entryPoints = [{{range getEntryPoints $instance.TraefikLabels }}
2017-08-25 09:42:03 +00:00
"{{.}}",
2017-12-16 18:22:16 +00:00
{{end}}]
2018-03-28 00:13:48 +00:00
basicAuth = [{{range getBasicAuth $instance.TraefikLabels }}
2017-09-07 15:34:03 +00:00
"{{.}}",
2017-12-16 18:22:16 +00:00
{{end}}]
2018-03-28 00:13:48 +00:00
{{ $whitelist := getWhiteList $instance.TraefikLabels }}
{{if $whitelist }}
[frontends."frontend-{{ $serviceName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
useXForwardedFor = {{ $whitelist.UseXForwardedFor }}
{{end}}
2018-03-28 00:13:48 +00:00
{{ $redirect := getRedirect $instance.TraefikLabels }}
2018-01-10 17:28:03 +00:00
{{if $redirect }}
[frontends."frontend-{{ $serviceName }}".redirect]
2018-01-10 17:28:03 +00:00
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
{{end}}
2018-03-28 00:13:48 +00:00
{{ $errorPages := getErrorPages $instance.TraefikLabels }}
2018-01-10 17:28:03 +00:00
{{if $errorPages }}
[frontends."frontend-{{ $serviceName }}".errors]
2018-01-10 17:28:03 +00:00
{{range $pageName, $page := $errorPages }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $serviceName }}".errors."{{ $pageName }}"]
2018-01-10 17:28:03 +00:00
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
2018-01-10 17:28:03 +00:00
backend = "{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
2018-03-28 00:13:48 +00:00
{{ $rateLimit := getRateLimit $instance.TraefikLabels }}
2018-01-10 17:28:03 +00:00
{{if $rateLimit }}
[frontends."frontend-{{ $serviceName }}".rateLimit]
2018-01-10 17:28:03 +00:00
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."frontend-{{ $serviceName }}".rateLimit.rateSet]
2018-01-10 17:28:03 +00:00
{{ range $limitName, $limit := $rateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $serviceName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-10 17:28:03 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
{{end}}
2018-03-28 00:13:48 +00:00
{{ $headers := getHeaders $instance.TraefikLabels }}
2018-01-10 17:28:03 +00:00
{{if $headers }}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers]
2018-01-10 17:28:03 +00:00
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
STSSeconds = {{ $headers.STSSeconds }}
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
STSPreload = {{ $headers.STSPreload }}
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
FrameDeny = {{ $headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
2018-01-10 17:28:03 +00:00
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
PublicKey = "{{ $headers.PublicKey }}"
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
IsDevelopment = {{ $headers.IsDevelopment }}
{{if $headers.AllowedHosts }}
AllowedHosts = [{{range $headers.AllowedHosts }}
"{{.}}",
{{end}}]
{{end}}
{{if $headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
"{{.}}",
{{end}}]
{{end}}
{{if $headers.CustomRequestHeaders }}
[frontends."frontend-{{ $serviceName }}".headers.customRequestHeaders]
{{range $k, $v := $headers.CustomRequestHeaders }}
2017-12-16 19:24:30 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-10 17:28:03 +00:00
{{if $headers.CustomResponseHeaders }}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers.customResponseHeaders]
2018-01-10 17:28:03 +00:00
{{range $k, $v := $headers.CustomResponseHeaders }}
2017-12-16 19:24:30 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-10 17:28:03 +00:00
{{if $headers.SSLProxyHeaders }}
2017-12-16 19:24:30 +00:00
[frontends."frontend-{{ $serviceName }}".headers.SSLProxyHeaders]
2018-01-10 17:28:03 +00:00
{{range $k, $v := $headers.SSLProxyHeaders }}
2017-12-16 19:24:30 +00:00
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2018-01-02 14:57:04 +00:00
{{end}}
2017-12-16 19:24:30 +00:00
2018-03-07 21:10:04 +00:00
[frontends."frontend-{{ $serviceName }}".routes."route-frontend-{{ $serviceName }}"]
2018-03-28 00:13:48 +00:00
rule = "{{ getFrontendRule $instance }}"
2017-12-16 18:22:16 +00:00
{{end}}
2017-08-25 09:42:03 +00:00
{{end}}