From f1d1ee95c098499e5a98974a3d4113e511f9ca59 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Wed, 27 Dec 2017 06:35:45 -0300 Subject: [PATCH] When upstream-hash-by annotation is used do not configure a lb algorithm --- 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 35fad4e4f9..6e3c167e4c 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) }}