traefik/templates/kubernetes.tmpl

219 lines
7.8 KiB
Cheetah
Raw Normal View History

2017-12-16 15:14:19 +00:00
[backends]
{{range $backendName, $backend := .Backends }}
2017-12-16 15:14:19 +00:00
[backends."{{ $backendName }}"]
2017-12-16 15:14:19 +00:00
{{if $backend.CircuitBreaker }}
2018-03-07 21:10:04 +00:00
[backends."{{ $backendName }}".circuitBreaker]
expression = "{{ $backend.CircuitBreaker.Expression }}"
{{end}}
2017-12-16 15:14:19 +00:00
[backends."{{ $backendName }}".loadBalancer]
method = "{{ $backend.LoadBalancer.Method }}"
sticky = {{ $backend.LoadBalancer.Sticky }}
{{if $backend.LoadBalancer.Stickiness }}
[backends."{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $backend.LoadBalancer.Stickiness.CookieName }}"
{{end}}
2018-01-31 14:32:04 +00:00
{{if $backend.MaxConn }}
2018-03-07 21:10:04 +00:00
[backends."{{ $backendName }}".maxConn]
2017-12-21 21:44:06 +00:00
amount = {{ $backend.MaxConn.Amount }}
extractorFunc = "{{ $backend.MaxConn.ExtractorFunc }}"
{{end}}
2018-01-31 14:32:04 +00:00
{{if $backend.Buffering }}
[backends."{{ $backendName }}".buffering]
maxRequestBodyBytes = {{ $backend.Buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $backend.Buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $backend.Buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $backend.Buffering.MemResponseBodyBytes }}
retryExpression = "{{ $backend.Buffering.RetryExpression }}"
{{end}}
{{range $serverName, $server := $backend.Servers }}
[backends."{{ $backendName }}".servers."{{ $serverName }}"]
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
{{end}}
2017-12-16 15:14:19 +00:00
{{end}}
2017-12-16 15:14:19 +00:00
[frontends]
{{range $frontendName, $frontend := .Frontends }}
2017-12-16 15:14:19 +00:00
[frontends."{{ $frontendName }}"]
backend = "{{ $frontend.Backend }}"
priority = {{ $frontend.Priority }}
passHostHeader = {{ $frontend.PassHostHeader }}
passTLSCert = {{ $frontend.PassTLSCert }}
2017-12-16 15:14:19 +00:00
entryPoints = [{{range $frontend.EntryPoints }}
2017-04-23 14:17:20 +00:00
"{{.}}",
2017-12-16 15:14:19 +00:00
{{end}}]
2017-12-15 10:48:03 +00:00
{{if $frontend.Auth }}
[frontends."{{ $frontendName }}".auth]
headerField = "X-WebAuth-User"
{{if $frontend.Auth.Basic }}
[frontends."{{ $frontendName }}".auth.basic]
removeHeader = {{$frontend.Auth.Basic.RemoveHeader}}
users = [{{range $frontend.Auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
{{if $frontend.Auth.Digest }}
[frontends."{{ $frontendName }}".auth.digest]
removeHeader = {{$frontend.Auth.Digest.RemoveHeader}}
users = [{{range $frontend.Auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
{{if $frontend.Auth.Forward }}
[frontends."{{ $frontendName }}".auth.forward]
address = "{{ $frontend.Auth.Forward.Address }}"
authResponseHeaders = [{{range $frontend.Auth.Forward.AuthResponseHeaders }}
"{{.}}",
{{end}}]
trustForwardHeader = {{ $frontend.Auth.Forward.TrustForwardHeader }}
{{if $frontend.Auth.Forward.TLS }}
[frontends."{{ $frontendName }}".auth.forward.tls]
cert = """{{ $frontend.Auth.Forward.TLS.Cert }}"""
key = """{{ $frontend.Auth.Forward.TLS.Key }}"""
insecureSkipVerify = {{ $frontend.Auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{end}}
{{if $frontend.WhiteList }}
[frontends."{{ $frontendName }}".whiteList]
sourceRange = [{{range $frontend.WhiteList.SourceRange }}
"{{.}}",
{{end}}]
useXForwardedFor = {{ $frontend.WhiteList.UseXForwardedFor }}
{{end}}
2017-12-16 15:14:19 +00:00
{{if $frontend.Redirect }}
[frontends."{{ $frontendName }}".redirect]
entryPoint = "{{ $frontend.Redirect.EntryPoint }}"
regex = "{{ $frontend.Redirect.Regex }}"
replacement = "{{ $frontend.Redirect.Replacement }}"
permanent = {{ $frontend.Redirect.Permanent }}
2017-12-16 15:14:19 +00:00
{{end}}
2017-12-15 10:48:03 +00:00
{{if $frontend.Errors }}
[frontends."{{ $frontendName }}".errors]
{{range $pageName, $page := $frontend.Errors }}
2018-03-07 21:10:04 +00:00
[frontends."{{ $frontendName }}".errors."{{ $pageName }}"]
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
backend = "{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
{{if $frontend.RateLimit }}
[frontends."{{ $frontendName }}".rateLimit]
2017-12-21 21:07:37 +00:00
extractorFunc = "{{ $frontend.RateLimit.ExtractorFunc }}"
[frontends."{{ $frontendName }}".rateLimit.rateSet]
{{range $limitName, $limit := $frontend.RateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
2017-12-21 21:07:37 +00:00
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
{{end}}
{{if $frontend.PassTLSClientCert }}
[frontends."{{ $frontendName }}".passTLSClientCert]
pem = {{ $frontend.PassTLSClientCert.PEM }}
{{ $infos := $frontend.PassTLSClientCert.Infos }}
{{if $infos }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."{{ $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-01-02 13:49:11 +00:00
{{if $frontend.Headers }}
[frontends."{{ $frontendName }}".headers]
SSLRedirect = {{ $frontend.Headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $frontend.Headers.SSLTemporaryRedirect }}
SSLHost = "{{ $frontend.Headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $frontend.Headers.SSLForceHost }}
STSSeconds = {{ $frontend.Headers.STSSeconds }}
STSIncludeSubdomains = {{ $frontend.Headers.STSIncludeSubdomains }}
STSPreload = {{ $frontend.Headers.STSPreload }}
ForceSTSHeader = {{ $frontend.Headers.ForceSTSHeader }}
FrameDeny = {{ $frontend.Headers.FrameDeny }}
CustomFrameOptionsValue = "{{ $frontend.Headers.CustomFrameOptionsValue }}"
ContentTypeNosniff = {{ $frontend.Headers.ContentTypeNosniff }}
BrowserXSSFilter = {{ $frontend.Headers.BrowserXSSFilter }}
2018-03-02 13:24:03 +00:00
CustomBrowserXSSValue = "{{ $frontend.Headers.CustomBrowserXSSValue }}"
ContentSecurityPolicy = "{{ $frontend.Headers.ContentSecurityPolicy }}"
PublicKey = "{{ $frontend.Headers.PublicKey }}"
ReferrerPolicy = "{{ $frontend.Headers.ReferrerPolicy }}"
IsDevelopment = {{ $frontend.Headers.IsDevelopment }}
{{if $frontend.Headers.AllowedHosts }}
AllowedHosts = [{{range $frontend.Headers.AllowedHosts }}
2017-12-16 15:14:19 +00:00
"{{.}}",
{{end}}]
{{end}}
{{if $frontend.Headers.HostsProxyHeaders }}
HostsProxyHeaders = [{{range $frontend.Headers.HostsProxyHeaders }}
2017-12-16 15:14:19 +00:00
"{{.}}",
{{end}}]
{{end}}
{{if $frontend.Headers.CustomRequestHeaders }}
[frontends."{{ $frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $frontend.Headers.CustomRequestHeaders }}
{{ $k }} = "{{ $v }}"
2017-12-16 15:14:19 +00:00
{{end}}
2017-11-28 12:36:03 +00:00
{{end}}
{{if $frontend.Headers.CustomResponseHeaders }}
[frontends."{{ $frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $frontend.Headers.CustomResponseHeaders }}
{{ $k }} = "{{ $v }}"
2017-12-16 15:14:19 +00:00
{{end}}
2017-11-28 12:36:03 +00:00
{{end}}
{{if $frontend.Headers.SSLProxyHeaders }}
[frontends."{{ $frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $frontend.Headers.SSLProxyHeaders }}
{{ $k }} = "{{ $v }}"
2017-12-16 15:14:19 +00:00
{{end}}
2017-11-28 12:36:03 +00:00
{{end}}
2017-12-16 15:14:19 +00:00
{{end}}
{{range $routeName, $route := $frontend.Routes }}
[frontends."{{ $frontendName }}".routes."{{ $routeName }}"]
rule = "{{ $route.Rule }}"
{{end}}
2017-12-16 15:14:19 +00:00
{{end}}
2017-12-16 15:14:19 +00:00
{{range $tls := .TLS }}
2018-01-24 10:57:06 +00:00
[[tls]]
2017-12-16 15:14:19 +00:00
entryPoints = [{{range $tls.EntryPoints }}
"{{.}}",
2017-12-16 15:14:19 +00:00
{{end}}]
2018-01-24 10:57:06 +00:00
[tls.certificate]
2017-12-16 15:14:19 +00:00
certFile = """{{ $tls.Certificate.CertFile }}"""
keyFile = """{{ $tls.Certificate.KeyFile }}"""
{{end}}