chore(kv): gen templates.
This commit is contained in:
parent
c95393b238
commit
5623a53464
1 changed files with 61 additions and 58 deletions
|
@ -602,84 +602,87 @@ func templatesKubernetesTmpl() (*asset, error) {
|
|||
return a, nil
|
||||
}
|
||||
|
||||
var _templatesKvTmpl = []byte(`{{$frontends := List .Prefix "/frontends/" }}
|
||||
{{$backends := List .Prefix "/backends/"}}
|
||||
{{$tlsconfiguration := List .Prefix "/tlsconfiguration/"}}
|
||||
var _templatesKvTmpl = []byte(`[backends]
|
||||
{{range $backend := List .Prefix "/backends/"}}
|
||||
{{$backendName := Last $backend}}
|
||||
|
||||
[backends]{{range $backends}}
|
||||
{{$backend := .}}
|
||||
{{$backendName := Last $backend}}
|
||||
{{$servers := ListServers $backend }}
|
||||
|
||||
{{$circuitBreaker := Get "" . "/circuitbreaker/" "expression"}}
|
||||
{{with $circuitBreaker}}
|
||||
[backends."{{$backendName}}".circuitBreaker]
|
||||
{{$circuitBreaker := Get "" $backend "/circuitbreaker/expression"}}
|
||||
{{with $circuitBreaker}}
|
||||
[backends."{{$backendName}}".circuitBreaker]
|
||||
expression = "{{$circuitBreaker}}"
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{$loadBalancer := Get "" . "/loadbalancer/" "method"}}
|
||||
{{with $loadBalancer}}
|
||||
[backends."{{$backendName}}".loadBalancer]
|
||||
{{$loadBalancer := Get "" $backend "/loadbalancer/method"}}
|
||||
{{with $loadBalancer}}
|
||||
[backends."{{$backendName}}".loadBalancer]
|
||||
method = "{{$loadBalancer}}"
|
||||
sticky = {{ getSticky . }}
|
||||
sticky = {{ getSticky $backend }}
|
||||
{{if hasStickinessLabel $backend}}
|
||||
[backends."{{$backendName}}".loadBalancer.stickiness]
|
||||
cookieName = "{{getStickinessCookieName $backend}}"
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{$healthCheck := Get "" . "/healthcheck/" "path"}}
|
||||
{{with $healthCheck}}
|
||||
[backends."{{$backendName}}".healthCheck]
|
||||
path = "{{$healthCheck}}"
|
||||
interval = "{{ Get "30s" $backend "/healthcheck/" "interval" }}"
|
||||
{{end}}
|
||||
|
||||
{{$maxConnAmt := Get "" . "/maxconn/" "amount"}}
|
||||
{{$maxConnExtractorFunc := Get "" . "/maxconn/" "extractorfunc"}}
|
||||
{{with $maxConnAmt}}
|
||||
{{with $maxConnExtractorFunc}}
|
||||
[backends."{{$backendName}}".maxConn]
|
||||
{{$maxConnAmt := Get "" $backend "/maxconn/amount"}}
|
||||
{{$maxConnExtractorFunc := Get "" $backend "/maxconn/extractorfunc"}}
|
||||
{{with $maxConnAmt}}
|
||||
{{with $maxConnExtractorFunc}}
|
||||
[backends."{{$backendName}}".maxConn]
|
||||
amount = {{$maxConnAmt}}
|
||||
extractorFunc = "{{$maxConnExtractorFunc}}"
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{$healthCheck := Get "" $backend "/healthcheck/path"}}
|
||||
{{with $healthCheck}}
|
||||
[backends."{{$backendName}}".healthCheck]
|
||||
path = "{{$healthCheck}}"
|
||||
interval = "{{ Get "30s" $backend "/healthcheck/interval" }}"
|
||||
{{end}}
|
||||
|
||||
{{range $server := ListServers $backend}}
|
||||
[backends."{{$backendName}}".servers."{{Last $server}}"]
|
||||
url = "{{Get "" $server "/url"}}"
|
||||
weight = {{Get "0" $server "/weight"}}
|
||||
{{end}}
|
||||
|
||||
{{end}}
|
||||
|
||||
{{range $servers}}
|
||||
[backends."{{$backendName}}".servers."{{Last .}}"]
|
||||
url = "{{Get "" . "/url"}}"
|
||||
weight = {{Get "0" . "/weight"}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
[frontends]
|
||||
{{range $frontend := List .Prefix "/frontends/" }}
|
||||
{{$frontendName := Last $frontend}}
|
||||
|
||||
[frontends]{{range $frontends}}
|
||||
{{$frontend := Last .}}
|
||||
{{$entryPoints := SplitGet . "/entrypoints"}}
|
||||
[frontends."{{$frontend}}"]
|
||||
backend = "{{Get "" . "/backend"}}"
|
||||
passHostHeader = {{Get "true" . "/passHostHeader"}}
|
||||
priority = {{Get "0" . "/priority"}}
|
||||
[frontends."{{$frontendName}}"]
|
||||
backend = "{{Get "" $frontend "/backend"}}"
|
||||
priority = {{Get "0" $frontend "/priority"}}
|
||||
passHostHeader = {{Get "true" $frontend "/passHostHeader"}}
|
||||
|
||||
{{$entryPoints := SplitGet $frontend "/entrypoints"}}
|
||||
entryPoints = [{{range $entryPoints}}
|
||||
"{{.}}",
|
||||
{{end}}]
|
||||
{{$routes := List . "/routes/"}}
|
||||
{{range $routes}}
|
||||
[frontends."{{$frontend}}".routes."{{Last .}}"]
|
||||
rule = "{{Get "" . "/rule"}}"
|
||||
{{end}}
|
||||
{{end}}]
|
||||
|
||||
{{range $route := List $frontend "/routes/"}}
|
||||
[frontends."{{$frontendName}}".routes."{{Last $route}}"]
|
||||
rule = "{{Get "" $route "/rule"}}"
|
||||
{{end}}
|
||||
|
||||
{{end}}
|
||||
|
||||
{{range $tlsconfiguration}}
|
||||
{{$entryPoints := SplitGet . "/entrypoints"}}
|
||||
{{range $tlsConfiguration := List .Prefix "/tlsconfiguration/"}}
|
||||
|
||||
[[tlsConfiguration]]
|
||||
entryPoints = [{{range $entryPoints}}
|
||||
"{{.}}",
|
||||
{{end}}]
|
||||
[tlsConfiguration.certificate]
|
||||
certFile = """{{Get "" . "/certificate" "/certfile"}}"""
|
||||
keyFile = """{{Get "" . "/certificate" "/keyfile"}}"""
|
||||
{{end}}
|
||||
|
||||
{{$entryPoints := SplitGet $tlsConfiguration "/entrypoints"}}
|
||||
entryPoints = [{{range $entryPoints}}
|
||||
"{{.}}",
|
||||
{{end}}]
|
||||
|
||||
[tlsConfiguration.certificate]
|
||||
certFile = """{{Get "" $tlsConfiguration "/certificate/certfile"}}"""
|
||||
keyFile = """{{Get "" $tlsConfiguration "/certificate/keyfile"}}"""
|
||||
|
||||
{{end}}
|
||||
`)
|
||||
|
||||
func templatesKvTmplBytes() ([]byte, error) {
|
||||
|
|
Loading…
Reference in a new issue