2016-04-12 07:49:37 +00:00
|
|
|
[backends]
|
|
|
|
{{range .Nodes}}
|
|
|
|
{{if ne (getAttribute "enable" .Service.Tags "true") "false"}}
|
2016-04-08 13:08:28 +00:00
|
|
|
[backends.backend-{{getBackend .}}.servers.{{.Service.Service | replace "." "-"}}--{{.Service.Address | replace "." "-"}}--{{.Service.Port}}]
|
2016-04-12 07:49:37 +00:00
|
|
|
url = "{{getAttribute "protocol" .Service.Tags "http"}}://{{.Service.Address}}:{{.Service.Port}}"
|
|
|
|
{{$weight := getAttribute "backend.weight" .Service.Tags ""}}
|
|
|
|
{{with $weight}}
|
|
|
|
weight = {{$weight}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{range .Services}}
|
|
|
|
{{$service := .ServiceName}}
|
|
|
|
{{$circuitBreaker := getAttribute "backend.circuitbreaker" .Attributes ""}}
|
|
|
|
{{with $circuitBreaker}}
|
|
|
|
[backends.backend-{{$service}}.circuitbreaker]
|
|
|
|
expression = "{{$circuitBreaker}}"
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{$loadBalancer := getAttribute "backend.loadbalancer" .Attributes ""}}
|
|
|
|
{{with $loadBalancer}}
|
|
|
|
[backends.backend-{{$service}}.loadbalancer]
|
|
|
|
method = "{{$loadBalancer}}"
|
|
|
|
{{end}}
|
2016-02-02 17:03:40 +00:00
|
|
|
{{end}}
|
|
|
|
|
|
|
|
[frontends]{{range .Services}}
|
2016-04-12 07:49:37 +00:00
|
|
|
[frontends.frontend-{{.ServiceName}}]
|
|
|
|
backend = "backend-{{.ServiceName}}"
|
|
|
|
passHostHeader = {{getAttribute "frontend.passHostHeader" .Attributes "false"}}
|
|
|
|
{{$entryPoints := getAttribute "frontend.entrypoints" .Attributes ""}}
|
|
|
|
{{with $entryPoints}}
|
|
|
|
entrypoints = [{{range getEntryPoints $entryPoints}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
|
|
|
[frontends.frontend-{{.ServiceName}}.routes.route-host-{{.ServiceName}}]
|
|
|
|
rule = "{{getFrontendRule .}}"
|
2016-02-02 17:03:40 +00:00
|
|
|
{{end}}
|