From 8105f1c3797fd935af5f7c2dcd1d966d3fa9fc00 Mon Sep 17 00:00:00 2001 From: Nicolas Bonneval Date: Thu, 24 Aug 2017 18:38:05 +0200 Subject: [PATCH] Enable loadbalancer.sticky for Consul Catalog --- templates/consul_catalog.tmpl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/templates/consul_catalog.tmpl b/templates/consul_catalog.tmpl index b47f82a17..1a2bd26f0 100644 --- a/templates/consul_catalog.tmpl +++ b/templates/consul_catalog.tmpl @@ -18,11 +18,9 @@ expression = "{{$circuitBreaker}}" {{end}} - {{$loadBalancer := getAttribute "backend.loadbalancer" .Attributes ""}} - {{with $loadBalancer}} [backends."backend-{{$service}}".loadbalancer] - method = "{{$loadBalancer}}" - {{end}} + sticky = {{getAttribute "backend.loadbalancer.sticky" .Attributes "false"}} + method = "{{getAttribute "backend.loadbalancer" .Attributes "wrr"}}" {{if hasMaxconnAttributes .Attributes}} [backends."backend-{{$service}}".maxconn]