traefik/templates/kv.tmpl

79 lines
2.2 KiB
Cheetah
Raw Normal View History

{{$frontends := List .Prefix "/frontends/" }}
{{$backends := List .Prefix "/backends/"}}
2018-01-23 15:30:07 +00:00
{{$tls := List .Prefix "/tls/"}}
2015-09-21 16:05:56 +00:00
[backends]{{range $backends}}
2015-09-21 16:05:56 +00:00
{{$backend := .}}
2017-10-10 09:10:02 +00:00
{{$backendName := Last $backend}}
{{$servers := ListServers $backend }}
2016-02-01 15:08:58 +00:00
{{$circuitBreaker := Get "" . "/circuitbreaker/" "expression"}}
{{with $circuitBreaker}}
2017-10-10 09:10:02 +00:00
[backends."{{$backendName}}".circuitBreaker]
expression = "{{$circuitBreaker}}"
{{end}}
2016-02-01 15:08:58 +00:00
{{$loadBalancer := Get "" . "/loadbalancer/" "method"}}
{{with $loadBalancer}}
2017-10-10 09:10:02 +00:00
[backends."{{$backendName}}".loadBalancer]
method = "{{$loadBalancer}}"
2017-10-16 15:38:03 +00:00
sticky = {{ getSticky . }}
2017-10-10 09:10:02 +00:00
{{if hasStickinessLabel $backend}}
2017-10-16 15:38:03 +00:00
[backends."{{$backendName}}".loadBalancer.stickiness]
cookieName = "{{getStickinessCookieName $backend}}"
2017-10-10 09:10:02 +00:00
{{end}}
{{end}}
{{$healthCheck := Get "" . "/healthcheck/" "path"}}
{{with $healthCheck}}
2017-10-10 09:10:02 +00:00
[backends."{{$backendName}}".healthCheck]
path = "{{$healthCheck}}"
interval = "{{ Get "30s" $backend "/healthcheck/" "interval" }}"
{{end}}
{{$maxConnAmt := Get "" . "/maxconn/" "amount"}}
{{$maxConnExtractorFunc := Get "" . "/maxconn/" "extractorfunc"}}
{{with $maxConnAmt}}
{{with $maxConnExtractorFunc}}
2017-10-10 09:10:02 +00:00
[backends."{{$backendName}}".maxConn]
amount = {{$maxConnAmt}}
extractorFunc = "{{$maxConnExtractorFunc}}"
{{end}}
{{end}}
2015-09-21 16:05:56 +00:00
{{range $servers}}
2017-10-10 09:10:02 +00:00
[backends."{{$backendName}}".servers."{{Last .}}"]
2016-02-01 15:08:58 +00:00
url = "{{Get "" . "/url"}}"
weight = {{Get "0" . "/weight"}}
2015-09-21 16:05:56 +00:00
{{end}}
{{end}}
[frontends]{{range $frontends}}
{{$frontend := Last .}}
2018-01-09 11:40:04 +00:00
{{$entryPoints := GetList . "/entrypoints"}}
[frontends."{{$frontend}}"]
2016-02-01 15:08:58 +00:00
backend = "{{Get "" . "/backend"}}"
passHostHeader = {{Get "true" . "/passHostHeader"}}
priority = {{Get "0" . "/priority"}}
2016-02-01 15:08:58 +00:00
entryPoints = [{{range $entryPoints}}
"{{.}}",
{{end}}]
{{$routes := List . "/routes/"}}
{{range $routes}}
[frontends."{{$frontend}}".routes."{{Last .}}"]
2016-02-01 15:08:58 +00:00
rule = "{{Get "" . "/rule"}}"
{{end}}
{{end}}
2018-01-23 15:30:07 +00:00
{{range $tls}}
{{$entryPoints := SplitGet . "/entrypoints"}}
2018-01-23 15:30:07 +00:00
[[tls]]
entryPoints = [{{range $entryPoints}}
"{{.}}",
{{end}}]
2018-01-23 15:30:07 +00:00
[tls.certificate]
certFile = """{{Get "" . "/certificate" "/certfile"}}"""
keyFile = """{{Get "" . "/certificate" "/keyfile"}}"""
{{end}}