Make the neutron-haproxy-wrapper compatible with haproxy 1.8
Currently we spawn haproxy with: ip netns exec ${NETNS} /usr/sbin/haproxy -Ds $ARGS. The reason for that was that with -Ds we keep a process in the foreground: -Ds Start in systemd daemon mode, keeping a process in foreground. Since haproxy 1.8 removed the haproxy-systemd-wrapper it also removed the '-Ds' option. In order to keep things running in the foreground we can just switch to using '-Ws' Which is the multiworker mode with systemd support which keeps the process in the foregroud. 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: Ia914de9b3438976d24bf09ad680e806a0fb6644e
This commit is contained in:
parent
a2c549a2ff
commit
d8691bcd9d
|
@ -52,7 +52,7 @@ describe 'tripleo::profile::base::neutron::wrappers::haproxy' do
|
|||
/set -x/
|
||||
)
|
||||
is_expected.to contain_file('/usr/local/bin/haproxy').with_content(
|
||||
/CMD="ip netns exec.*\/usr\/sbin\/haproxy -Ds/
|
||||
/.*haproxy -Ds.*haproxy -Ws.*/
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ describe 'tripleo::profile::base::neutron::wrappers::haproxy' do
|
|||
/^NAME=neutron-haproxy-/
|
||||
)
|
||||
is_expected.to contain_file('/usr/local/bin/haproxy').with_content(
|
||||
/CMD='\/usr\/sbin\/haproxy -Ds'/
|
||||
/.*haproxy -Ds.*haproxy -Ws.*/
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,12 +19,13 @@ ARGS="$@"
|
|||
# --dhcp-hostsfile=/var/lib/neutron/dhcp/317716b8-919a-4a6f-8db1-78128ec3b100/host ...
|
||||
NETNS=$(ip netns identify)
|
||||
NAME=neutron-haproxy-${NETNS}
|
||||
HAPROXY_CMD='$(if [ -f /usr/sbin/haproxy-systemd-wrapper ]; then echo "/usr/sbin/haproxy -Ds"; else echo "/usr/sbin/haproxy -Ws"; fi)'
|
||||
<%- if $container_cli == 'docker' { -%>
|
||||
CLI='docker'
|
||||
CMD="ip netns exec ${NETNS} /usr/sbin/haproxy -Ds"
|
||||
CMD="ip netns exec ${NETNS} "'$HAPROXY'
|
||||
<%- } elsif $container_cli == 'podman' { -%>
|
||||
CLI="nsenter --net=/run/netns/${NETNS} --preserve-credentials -m -t 1 podman"
|
||||
CMD='/usr/sbin/haproxy -Ds'
|
||||
CMD='$HAPROXY'
|
||||
<%- } else { -%>
|
||||
CLI='echo noop'
|
||||
CMD='echo noop'
|
||||
|
@ -54,4 +55,4 @@ $CLI run --detach \
|
|||
-u root \
|
||||
--name $NAME \
|
||||
<%=$image_name%> \
|
||||
$CMD $ARGS
|
||||
/bin/bash -c "HAPROXY=\"$HAPROXY_CMD\"; exec $CMD $ARGS"
|
||||
|
|
Loading…
Reference in New Issue