feat(ecs): add circuit Breaker label.

This commit is contained in:
Fernandez Ludovic 2017-12-16 19:51:39 +01:00 committed by Traefiker
parent 07a6d48a27
commit 66f46c5b96
2 changed files with 26 additions and 19 deletions

View file

@ -33,6 +33,8 @@ func (p *Provider) buildConfiguration(services map[string][]ecsInstance) (*types
"getHealthCheckPath": getFuncFirstStringValue(label.TraefikBackendHealthCheckPath, ""), "getHealthCheckPath": getFuncFirstStringValue(label.TraefikBackendHealthCheckPath, ""),
"getHealthCheckPort": getFuncFirstIntValue(label.TraefikBackendHealthCheckPort, label.DefaultBackendHealthCheckPort), "getHealthCheckPort": getFuncFirstIntValue(label.TraefikBackendHealthCheckPort, label.DefaultBackendHealthCheckPort),
"getHealthCheckInterval": getFuncFirstStringValue(label.TraefikBackendHealthCheckInterval, ""), "getHealthCheckInterval": getFuncFirstStringValue(label.TraefikBackendHealthCheckInterval, ""),
"hasCircuitBreakerLabel": hasFuncFirst(label.TraefikBackendCircuitBreakerExpression),
"getCircuitBreakerExpression": getFuncFirstStringValue(label.TraefikBackendCircuitBreakerExpression, label.DefaultCircuitBreakerExpression),
} }
return p.GetConfiguration("templates/ecs.tmpl", ecsFuncMap, struct { return p.GetConfiguration("templates/ecs.tmpl", ecsFuncMap, struct {
Services map[string][]ecsInstance Services map[string][]ecsInstance

View file

@ -1,6 +1,11 @@
[backends] [backends]
{{range $serviceName, $instances := .Services}} {{range $serviceName, $instances := .Services}}
{{if hasCircuitBreakerLabel $instances}}
[backends.backend-{{ $serviceName }}.circuitBreaker]
expression = "{{getCircuitBreakerExpression $instances}}"
{{end}}
{{if hasLoadBalancerLabel $instances}} {{if hasLoadBalancerLabel $instances}}
[backends.backend-{{ $serviceName }}.loadBalancer] [backends.backend-{{ $serviceName }}.loadBalancer]
method = "{{ getLoadBalancerMethod $instances}}" method = "{{ getLoadBalancerMethod $instances}}"