From dd9d13696b9d6d76301d28038cf1aa3be08dba0e Mon Sep 17 00:00:00 2001 From: pierreozoux <pierre@ozoux.net> Date: Sat, 26 Nov 2016 17:36:31 +0000 Subject: [PATCH] fixes various networks bug --- templates/haproxy.cfg.tmpl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/templates/haproxy.cfg.tmpl b/templates/haproxy.cfg.tmpl index bed02a2..6a754dd 100644 --- a/templates/haproxy.cfg.tmpl +++ b/templates/haproxy.cfg.tmpl @@ -43,8 +43,17 @@ backend {{ $host }} option http-server-close cookie SERVERID insert nocache indirect {{ range $container := $containers }} - {{ $network := index $container.Networks 0 }} + {{ $networkLen := len $container.Networks }} + {{ if eq $networkLen 1 }} + {{ $network := index $container.Networks 0 }} server Server {{ $network.IP }}:80 cookie Server + {{ else }} + {{ range $network := $container.Networks }} + {{ if eq $network.Name "lb_web" }} + server Server {{ $network.IP }}:80 cookie Server + {{end}} + {{end}} + {{end}} {{end}} {{end}} -- GitLab