From 54cfad0a07b497b0e035c74ad0ddd44da9008548 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Wed, 27 Dec 2017 07:48:06 -0300 Subject: [PATCH] When upstream-hash-by annotation is used do not configure a lb algorithm (#1858) --- rootfs/etc/nginx/template/nginx.tmpl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rootfs/etc/nginx/template/nginx.tmpl b/rootfs/etc/nginx/template/nginx.tmpl index 35fad4e4f..6e3c167e4 100644 --- a/rootfs/etc/nginx/template/nginx.tmpl +++ b/rootfs/etc/nginx/template/nginx.tmpl @@ -314,13 +314,11 @@ http { upstream {{ $upstream.Name }} { - # Load balance algorithm; empty for round robin, which is the default - {{ if ne $cfg.LoadBalanceAlgorithm "round_robin" }} - {{ $cfg.LoadBalanceAlgorithm }}; - {{ end }} - {{ if $upstream.UpstreamHashBy }} hash {{ $upstream.UpstreamHashBy }} consistent; + {{ else }} + # Load balance algorithm; empty for round robin, which is the default + {{ if ne $cfg.LoadBalanceAlgorithm "round_robin" }}{{ $cfg.LoadBalanceAlgorithm }};{{ end }} {{ end }} {{ if (gt $cfg.UpstreamKeepaliveConnections 0) }}