chore(k8s): gen templates.
This commit is contained in:
parent
62df067fac
commit
c944d203fb
1 changed files with 130 additions and 89 deletions
|
@ -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]
|
||||||
[backends."{{$backendName}}"]
|
{{range $backendName, $backend := .Backends }}
|
||||||
{{if $backend.CircuitBreaker}}
|
|
||||||
[backends."{{$backendName}}".circuitbreaker]
|
[backends."{{ $backendName }}"]
|
||||||
expression = "{{$backend.CircuitBreaker.Expression}}"
|
|
||||||
|
{{if $backend.CircuitBreaker }}
|
||||||
|
[backends."{{ $backendName }} ".circuitBreaker]
|
||||||
|
expression = "{{ $backend.CircuitBreaker.Expression }}"
|
||||||
{{end}}
|
{{end}}
|
||||||
[backends."{{$backendName}}".loadbalancer]
|
|
||||||
method = "{{$backend.LoadBalancer.Method}}"
|
[backends."{{ $backendName }}".loadBalancer]
|
||||||
{{if $backend.LoadBalancer.Sticky}}
|
method = "{{ $backend.LoadBalancer.Method }}"
|
||||||
sticky = true
|
sticky = {{ $backend.LoadBalancer.Sticky }}
|
||||||
{{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 }}
|
||||||
|
@ -807,95 +815,128 @@ var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend
|
||||||
retryExpression = "{{ $backend.Buffering.RetryExpression }}"
|
retryExpression = "{{ $backend.Buffering.RetryExpression }}"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{range $serverName, $server := $backend.Servers}}
|
{{range $serverName, $server := $backend.Servers }}
|
||||||
[backends."{{$backendName}}".servers."{{$serverName}}"]
|
[backends."{{ $backendName }}".servers."{{ $serverName }}"]
|
||||||
url = "{{$server.URL}}"
|
url = "{{ $server.URL }}"
|
||||||
weight = {{$server.Weight}}
|
weight = {{ $server.Weight }}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
[frontends]{{range $frontendName, $frontend := .Frontends}}
|
[frontends]
|
||||||
[frontends."{{$frontendName}}"]
|
{{range $frontendName, $frontend := .Frontends }}
|
||||||
backend = "{{$frontend.Backend}}"
|
|
||||||
priority = {{$frontend.Priority}}
|
|
||||||
passHostHeader = {{$frontend.PassHostHeader}}
|
|
||||||
entryPoints = [{{range $frontend.EntryPoints}}
|
|
||||||
"{{.}}",
|
|
||||||
{{end}}]
|
|
||||||
basicAuth = [{{range $frontend.BasicAuth}}
|
|
||||||
"{{.}}",
|
|
||||||
{{end}}]
|
|
||||||
whitelistSourceRange = [{{range $frontend.WhitelistSourceRange}}
|
|
||||||
"{{.}}",
|
|
||||||
{{end}}]
|
|
||||||
|
|
||||||
{{if $frontend.Redirect}}
|
[frontends."{{ $frontendName }}"]
|
||||||
[frontends."{{$frontendName}}".redirect]
|
backend = "{{ $frontend.Backend }}"
|
||||||
entryPoint = "{{$frontend.Redirect.EntryPoint}}"
|
priority = {{ $frontend.Priority }}
|
||||||
regex = "{{$frontend.Redirect.Regex}}"
|
passHostHeader = {{ $frontend.PassHostHeader }}
|
||||||
replacement = "{{$frontend.Redirect.Replacement}}"
|
passTLSCert = {{ $frontend.PassTLSCert }}
|
||||||
{{end}}
|
|
||||||
|
entryPoints = [{{range $frontend.EntryPoints }}
|
||||||
|
"{{.}}",
|
||||||
|
{{end}}]
|
||||||
|
|
||||||
|
basicAuth = [{{range $frontend.BasicAuth }}
|
||||||
|
"{{.}}",
|
||||||
|
{{end}}]
|
||||||
|
|
||||||
|
whitelistSourceRange = [{{range $frontend.WhitelistSourceRange }}
|
||||||
|
"{{.}}",
|
||||||
|
{{end}}]
|
||||||
|
|
||||||
|
{{if $frontend.Redirect }}
|
||||||
|
[frontends."{{ $frontendName }}".redirect]
|
||||||
|
entryPoint = "{{ $frontend.Redirect.EntryPoint }}"
|
||||||
|
regex = "{{ $frontend.Redirect.Regex }}"
|
||||||
|
replacement = "{{ $frontend.Redirect.Replacement }}"
|
||||||
|
{{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 }}
|
||||||
SSLTemporaryRedirect = {{$frontend.Headers.SSLTemporaryRedirect}}
|
SSLTemporaryRedirect = {{ $frontend.Headers.SSLTemporaryRedirect }}
|
||||||
SSLHost = "{{$frontend.Headers.SSLHost}}"
|
SSLHost = "{{ $frontend.Headers.SSLHost }}"
|
||||||
STSSeconds = {{$frontend.Headers.STSSeconds}}
|
STSSeconds = {{ $frontend.Headers.STSSeconds }}
|
||||||
STSIncludeSubdomains = {{$frontend.Headers.STSIncludeSubdomains}}
|
STSIncludeSubdomains = {{ $frontend.Headers.STSIncludeSubdomains }}
|
||||||
STSPreload = {{$frontend.Headers.STSPreload}}
|
STSPreload = {{ $frontend.Headers.STSPreload }}
|
||||||
ForceSTSHeader = {{$frontend.Headers.ForceSTSHeader}}
|
ForceSTSHeader = {{ $frontend.Headers.ForceSTSHeader }}
|
||||||
FrameDeny = {{$frontend.Headers.FrameDeny}}
|
FrameDeny = {{ $frontend.Headers.FrameDeny }}
|
||||||
CustomFrameOptionsValue = "{{$frontend.Headers.CustomFrameOptionsValue}}"
|
CustomFrameOptionsValue = "{{ $frontend.Headers.CustomFrameOptionsValue }}"
|
||||||
ContentTypeNosniff = {{$frontend.Headers.ContentTypeNosniff}}
|
ContentTypeNosniff = {{ $frontend.Headers.ContentTypeNosniff }}
|
||||||
BrowserXSSFilter = {{$frontend.Headers.BrowserXSSFilter}}
|
BrowserXSSFilter = {{ $frontend.Headers.BrowserXSSFilter }}
|
||||||
ContentSecurityPolicy = "{{$frontend.Headers.ContentSecurityPolicy}}"
|
ContentSecurityPolicy = "{{ $frontend.Headers.ContentSecurityPolicy }}"
|
||||||
PublicKey = "{{$frontend.Headers.PublicKey}}"
|
PublicKey = "{{ $frontend.Headers.PublicKey }}"
|
||||||
ReferrerPolicy = "{{$frontend.Headers.ReferrerPolicy}}"
|
ReferrerPolicy = "{{ $frontend.Headers.ReferrerPolicy }}"
|
||||||
IsDevelopment = {{$frontend.Headers.IsDevelopment}}
|
IsDevelopment = {{ $frontend.Headers.IsDevelopment }}
|
||||||
{{if $frontend.Headers.AllowedHosts}}
|
{{if $frontend.Headers.AllowedHosts }}
|
||||||
AllowedHosts = [{{range $frontend.Headers.AllowedHosts}}
|
AllowedHosts = [{{range $frontend.Headers.AllowedHosts }}
|
||||||
"{{.}}",
|
"{{.}}",
|
||||||
{{end}}]
|
{{end}}]
|
||||||
|
{{end}}
|
||||||
|
{{if $frontend.Headers.HostsProxyHeaders }}
|
||||||
|
HostsProxyHeaders = [{{range $frontend.Headers.HostsProxyHeaders }}
|
||||||
|
"{{.}}",
|
||||||
|
{{end}}]
|
||||||
|
{{end}}
|
||||||
|
{{if $frontend.Headers.CustomRequestHeaders }}
|
||||||
|
[frontends."{{ $frontendName }}".headers.customRequestHeaders]
|
||||||
|
{{range $k, $v := $frontend.Headers.CustomRequestHeaders }}
|
||||||
|
{{ $k }} = "{{ $v }}"
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if $frontend.Headers.CustomResponseHeaders }}
|
||||||
|
[frontends."{{ $frontendName }}".headers.customResponseHeaders]
|
||||||
|
{{range $k, $v := $frontend.Headers.CustomResponseHeaders }}
|
||||||
|
{{ $k }} = "{{ $v }}"
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if $frontend.Headers.SSLProxyHeaders }}
|
||||||
|
[frontends."{{ $frontendName }}".headers.SSLProxyHeaders]
|
||||||
|
{{range $k, $v := $frontend.Headers.SSLProxyHeaders }}
|
||||||
|
{{ $k }} = "{{ $v }}"
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if $frontend.Headers.HostsProxyHeaders}}
|
|
||||||
HostsProxyHeaders = [{{range $frontend.Headers.HostsProxyHeaders}}
|
{{range $routeName, $route := $frontend.Routes }}
|
||||||
"{{.}}",
|
[frontends."{{ $frontendName }}".routes."{{ $routeName }}"]
|
||||||
{{end}}]
|
rule = "{{ $route.Rule }}"
|
||||||
{{end}}
|
|
||||||
{{if $frontend.Headers.CustomRequestHeaders}}
|
|
||||||
[frontends."{{$frontendName}}".headers.customrequestheaders]
|
|
||||||
{{range $k, $v := $frontend.Headers.CustomRequestHeaders}}
|
|
||||||
{{$k}} = "{{$v}}"
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{if $frontend.Headers.CustomResponseHeaders}}
|
|
||||||
[frontends."{{$frontendName}}".headers.customresponseheaders]
|
|
||||||
{{range $k, $v := $frontend.Headers.CustomResponseHeaders}}
|
|
||||||
{{$k}} = "{{$v}}"
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{if $frontend.Headers.SSLProxyHeaders}}
|
|
||||||
[frontends."{{$frontendName}}".headers.SSLProxyHeaders]
|
|
||||||
{{range $k, $v := $frontend.Headers.SSLProxyHeaders}}
|
|
||||||
{{$k}} = "{{$v}}"
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{range $routeName, $route := $frontend.Routes}}
|
|
||||||
[frontends."{{$frontendName}}".routes."{{$routeName}}"]
|
|
||||||
rule = "{{$route.Rule}}"
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{range $tls := .TLS}}
|
{{range $tls := .TLS }}
|
||||||
[[tls]]
|
[[tls]]
|
||||||
entryPoints = [{{range $tls.EntryPoints}}
|
entryPoints = [{{range $tls.EntryPoints }}
|
||||||
"{{.}}",
|
"{{.}}",
|
||||||
{{end}}]
|
{{end}}]
|
||||||
[tls.certificate]
|
[tls.certificate]
|
||||||
certFile = """{{$tls.Certificate.CertFile}}"""
|
certFile = """{{ $tls.Certificate.CertFile }}"""
|
||||||
keyFile = """{{$tls.Certificate.KeyFile}}"""
|
keyFile = """{{ $tls.Certificate.KeyFile }}"""
|
||||||
{{end}}
|
{{end}}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue