chore(k8s): gen templates.

This commit is contained in:
Fernandez Ludovic 2018-01-31 16:28:27 +01:00 committed by Traefiker
parent 62df067fac
commit c944d203fb

View file

@ -782,22 +782,30 @@ func templatesEurekaTmpl() (*asset, error) {
return a, nil return a, nil
} }
var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend := .Backends}} var _templatesKubernetesTmpl = []byte(`[backends]
{{range $backendName, $backend := .Backends }}
[backends."{{ $backendName }}"] [backends."{{ $backendName }}"]
{{if $backend.CircuitBreaker }} {{if $backend.CircuitBreaker }}
[backends."{{$backendName}}".circuitbreaker] [backends."{{ $backendName }} ".circuitBreaker]
expression = "{{ $backend.CircuitBreaker.Expression }}" expression = "{{ $backend.CircuitBreaker.Expression }}"
{{end}} {{end}}
[backends."{{$backendName}}".loadbalancer]
[backends."{{ $backendName }}".loadBalancer]
method = "{{ $backend.LoadBalancer.Method }}" method = "{{ $backend.LoadBalancer.Method }}"
{{if $backend.LoadBalancer.Sticky}} sticky = {{ $backend.LoadBalancer.Sticky }}
sticky = true
{{end}}
{{if $backend.LoadBalancer.Stickiness }} {{if $backend.LoadBalancer.Stickiness }}
[backends."{{$backendName}}".loadbalancer.stickiness] [backends."{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $backend.LoadBalancer.Stickiness.CookieName }}" cookieName = "{{ $backend.LoadBalancer.Stickiness.CookieName }}"
{{end}} {{end}}
{{if $backend.MaxConn }}
[backends.backend-{{ $backendName }}.maxConn]
amount = {{ $backend.MaxConn.Amount }}
extractorFunc = "{{ $backend.MaxConn.ExtractorFunc }}"
{{end}}
{{if $backend.Buffering }} {{if $backend.Buffering }}
[backends."{{ $backendName }}".buffering] [backends."{{ $backendName }}".buffering]
maxRequestBodyBytes = {{ $backend.Buffering.MaxRequestBodyBytes }} maxRequestBodyBytes = {{ $backend.Buffering.MaxRequestBodyBytes }}
@ -812,19 +820,26 @@ var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend
url = "{{ $server.URL }}" url = "{{ $server.URL }}"
weight = {{ $server.Weight }} weight = {{ $server.Weight }}
{{end}} {{end}}
{{end}} {{end}}
[frontends]{{range $frontendName, $frontend := .Frontends}} [frontends]
{{range $frontendName, $frontend := .Frontends }}
[frontends."{{ $frontendName }}"] [frontends."{{ $frontendName }}"]
backend = "{{ $frontend.Backend }}" backend = "{{ $frontend.Backend }}"
priority = {{ $frontend.Priority }} priority = {{ $frontend.Priority }}
passHostHeader = {{ $frontend.PassHostHeader }} passHostHeader = {{ $frontend.PassHostHeader }}
passTLSCert = {{ $frontend.PassTLSCert }}
entryPoints = [{{range $frontend.EntryPoints }} entryPoints = [{{range $frontend.EntryPoints }}
"{{.}}", "{{.}}",
{{end}}] {{end}}]
basicAuth = [{{range $frontend.BasicAuth }} basicAuth = [{{range $frontend.BasicAuth }}
"{{.}}", "{{.}}",
{{end}}] {{end}}]
whitelistSourceRange = [{{range $frontend.WhitelistSourceRange }} whitelistSourceRange = [{{range $frontend.WhitelistSourceRange }}
"{{.}}", "{{.}}",
{{end}}] {{end}}]
@ -836,6 +851,30 @@ var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend
replacement = "{{ $frontend.Redirect.Replacement }}" replacement = "{{ $frontend.Redirect.Replacement }}"
{{end}} {{end}}
{{if $frontend.Errors }}
[frontends."frontend-{{ $frontendName }}".errors]
{{range $pageName, $page := $frontend.Errors }}
[frontends."frontend-{{ $frontendName }}".errors.{{ $pageName }}]
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
backend = "{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
{{if $frontend.RateLimit }}
[frontends."frontend-{{ $frontendName }}".rateLimit]
extractorFunc = "{{ $frontend.RateLimit.ExtractorFunc }}"
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet]
{{range $limitName, $limit := $frontend.RateLimit.RateSet }}
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet.{{ $limitName }}]
period = "{{ $limit.Period }}"
average = {{ $limit.Average }}
burst = {{ $limit.Burst }}
{{end}}
{{end}}
{{if $frontend.Headers }} {{if $frontend.Headers }}
[frontends."{{ $frontendName }}".headers] [frontends."{{ $frontendName }}".headers]
SSLRedirect = {{ $frontend.Headers.SSLRedirect }} SSLRedirect = {{ $frontend.Headers.SSLRedirect }}
@ -864,13 +903,13 @@ var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend
{{end}}] {{end}}]
{{end}} {{end}}
{{if $frontend.Headers.CustomRequestHeaders }} {{if $frontend.Headers.CustomRequestHeaders }}
[frontends."{{$frontendName}}".headers.customrequestheaders] [frontends."{{ $frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $frontend.Headers.CustomRequestHeaders }} {{range $k, $v := $frontend.Headers.CustomRequestHeaders }}
{{ $k }} = "{{ $v }}" {{ $k }} = "{{ $v }}"
{{end}} {{end}}
{{end}} {{end}}
{{if $frontend.Headers.CustomResponseHeaders }} {{if $frontend.Headers.CustomResponseHeaders }}
[frontends."{{$frontendName}}".headers.customresponseheaders] [frontends."{{ $frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $frontend.Headers.CustomResponseHeaders }} {{range $k, $v := $frontend.Headers.CustomResponseHeaders }}
{{ $k }} = "{{ $v }}" {{ $k }} = "{{ $v }}"
{{end}} {{end}}
@ -882,10 +921,12 @@ var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend
{{end}} {{end}}
{{end}} {{end}}
{{end}} {{end}}
{{range $routeName, $route := $frontend.Routes }} {{range $routeName, $route := $frontend.Routes }}
[frontends."{{ $frontendName }}".routes."{{ $routeName }}"] [frontends."{{ $frontendName }}".routes."{{ $routeName }}"]
rule = "{{ $route.Rule }}" rule = "{{ $route.Rule }}"
{{end}} {{end}}
{{end}} {{end}}
{{range $tls := .TLS }} {{range $tls := .TLS }}