traefik/templates/ecs.tmpl

259 lines
9.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-08-27 14:32:05 +00:00
{{ $circuitBreaker := getCircuitBreaker $firstInstance.SegmentLabels }}
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-10-29 17:42:03 +00:00
{{ $responseForwarding := getResponseForwarding $firstInstance.SegmentLabels }}
{{if $responseForwarding }}
[backends."backend-{{ $serviceName }}".responseForwarding]
flushInterval = "{{ $responseForwarding.FlushInterval }}"
{{end}}
2018-08-27 14:32:05 +00:00
{{ $loadBalancer := getLoadBalancer $firstInstance.SegmentLabels }}
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-08-27 14:32:05 +00:00
{{ $maxConn := getMaxConn $firstInstance.SegmentLabels }}
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-08-27 14:32:05 +00:00
{{ $healthCheck := getHealthCheck $firstInstance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $healthCheck }}
2018-03-07 21:10:04 +00:00
[backends."backend-{{ $serviceName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
2018-01-10 17:28:03 +00:00
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends."backend-{{ $serviceName }}".healthCheck.headers]
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
2017-12-16 18:22:16 +00:00
{{end}}
2018-08-27 14:32:05 +00:00
{{ $buffering := getBuffering $firstInstance.SegmentLabels }}
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-08-27 14:32:05 +00:00
{{ $frontendName := getFrontendName $instance }}
[frontends."frontend-{{ $frontendName }}"]
2017-12-16 18:22:16 +00:00
backend = "backend-{{ $serviceName }}"
2018-08-27 14:32:05 +00:00
priority = {{ getPriority $instance.SegmentLabels }}
passHostHeader = {{ getPassHostHeader $instance.SegmentLabels }}
passTLSCert = {{ getPassTLSCert $instance.SegmentLabels }}
2017-12-16 18:22:16 +00:00
2018-08-27 14:32:05 +00:00
entryPoints = [{{range getEntryPoints $instance.SegmentLabels }}
2017-08-25 09:42:03 +00:00
"{{.}}",
2017-12-16 18:22:16 +00:00
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $instance.SegmentLabels }}
{{if $tlsClientCert }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
{{end}}
{{end}}
{{end}}
2018-08-27 14:32:05 +00:00
{{ $auth := getAuth $instance.SegmentLabels }}
2018-07-06 14:52:04 +00:00
{{if $auth }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth]
2018-07-06 14:52:04 +00:00
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth.forward]
2018-07-06 14:52:04 +00:00
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.AuthResponseHeaders }}
authResponseHeaders = [{{range $auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-07-06 14:52:04 +00:00
{{if $auth.Forward.TLS }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth.forward.tls]
2018-07-06 14:52:04 +00:00
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth.basic]
removeHeader = {{ $auth.Basic.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
{{if $auth.Digest }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2017-12-16 18:22:16 +00:00
2018-08-27 14:32:05 +00:00
{{ $whitelist := getWhiteList $instance.SegmentLabels }}
{{if $whitelist }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
useXForwardedFor = {{ $whitelist.UseXForwardedFor }}
{{end}}
2018-08-27 14:32:05 +00:00
{{ $redirect := getRedirect $instance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $redirect }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".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-08-27 14:32:05 +00:00
{{ $errorPages := getErrorPages $instance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $errorPages }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".errors]
2018-01-10 17:28:03 +00:00
{{range $pageName, $page := $errorPages }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".errors."{{ $pageName }}"]
2018-01-10 17:28:03 +00:00
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
2018-04-11 11:54:03 +00:00
backend = "backend-{{ $page.Backend }}"
2018-01-10 17:28:03 +00:00
query = "{{ $page.Query }}"
{{end}}
{{end}}
2018-08-27 14:32:05 +00:00
{{ $rateLimit := getRateLimit $instance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $rateLimit }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit]
2018-01-10 17:28:03 +00:00
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet]
2018-01-10 17:28:03 +00:00
{{ range $limitName, $limit := $rateLimit.RateSet }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2018-01-10 17:28:03 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
{{end}}
2018-08-27 14:32:05 +00:00
{{ $headers := getHeaders $instance.SegmentLabels }}
2018-01-10 17:28:03 +00:00
{{if $headers }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".headers]
2018-01-10 17:28:03 +00:00
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
2018-01-10 17:28:03 +00:00
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 }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".headers.customRequestHeaders]
2018-01-10 17:28:03 +00:00
{{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 }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".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 }}
2018-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".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-08-27 14:32:05 +00:00
[frontends."frontend-{{ $frontendName }}".routes."route-frontend-{{ $frontendName }}"]
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}}