Transitioning to HAProxy 1.8

Haproxy 1.8 brings in a specific change that breaks us:
It removes the haproxy-systemd-wrapper which
we use in order to be able to reload the config file without
restarting the whole container (important in TLS scenarios).

We fix this by calling the haproxy binary directly and
using the master-worker mode (-Ws) which allows to receive
a SIGUSR2 command which will then reload the config for
all the workers. It should also not background.

This commit keeps backward compatibility with current HAProxy
to ease the transition to new HAProxy.

Co-Authored-By: Damien Ciabrini <dciabrin@redhat.com>

Change-Id: I93943efefa22b9107c85f9f5e0bd4c3c1ab867ed
(cherry picked from commit e26ef65e50)
This commit is contained in:
Michele Baldessari 2018-10-04 10:55:55 +02:00
parent 7e4577fd10
commit 2f3ffcc652
2 changed files with 8 additions and 2 deletions

View File

@ -174,7 +174,10 @@ outputs:
- null - null
kolla_config: kolla_config:
/var/lib/kolla/config_files/haproxy.json: /var/lib/kolla/config_files/haproxy.json:
command: /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg # HAProxy 1.8 doesn't ship haproxy-systemd-wrapper, we have
# to use a new dedicated option for live config reload.
# Note: we can't use quotes in kolla command, hence the workaround
command: bash -c $* -- eval if [ -f /usr/sbin/haproxy-systemd-wrapper ]; then exec /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg; else exec /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -Ws; fi
config_files: config_files:
- source: "/var/lib/kolla/config_files/src/*" - source: "/var/lib/kolla/config_files/src/*"
dest: "/" dest: "/"

View File

@ -177,7 +177,10 @@ outputs:
data: *tls_mapping data: *tls_mapping
kolla_config: kolla_config:
/var/lib/kolla/config_files/haproxy.json: /var/lib/kolla/config_files/haproxy.json:
command: /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg # HAProxy 1.8 doesn't ship haproxy-systemd-wrapper, we have
# to use a new dedicated option for live config reload.
# Note: we can't use quotes in kolla command, hence the workaround
command: bash -c $* -- eval if [ -f /usr/sbin/haproxy-systemd-wrapper ]; then exec /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg; else exec /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -Ws; fi
config_files: config_files:
- source: "/var/lib/kolla/config_files/src/*" - source: "/var/lib/kolla/config_files/src/*"
dest: "/" dest: "/"