Enable lo interface in the amphora-haproxy netns

Configure the lo interface in the amphora-haproxy namespace.
It fixes issues with the synchronization of haproxy peer/stick tables
when updating a load balancer configuration.

Story 2009005
Task 42682

Change-Id: I15997acaf12258ec483286dad676efdea8963611
This commit is contained in:
Gregory Thiemonge 2021-06-24 10:14:03 +02:00
parent 1d77e93f28
commit 4443596e29
3 changed files with 13 additions and 1 deletions

View File

@ -390,7 +390,7 @@ class RH(BaseOS):
if not network_dir:
network_dir = self.get_network_path()
if not ignore:
ignore = shutil.ignore_patterns('ifcfg-eth0*', 'ifcfg-lo*')
ignore = shutil.ignore_patterns('ifcfg-eth0*')
super().create_netns_dir(
network_dir, netns_network_dir, ignore)

View File

@ -26,7 +26,11 @@ ExecStart=-/bin/sh -c '/usr/bin/sort -k 1 /var/lib/octavia/plugged_interfaces >
ExecStart=-/bin/sh -c '/sbin/ip link | awk \'{getline n; print $0,n}\' | awk \'{sub(":","",$2)} { for(i=1;i<=NF;i++) if ($i == "link/ether") {print $(i+1) " " $2} }\' | sort -k 1 | join -j 1 - /var/lib/octavia/plugged_interfaces.sorted | awk \'{system("ip link set "$2" netns {{ amphora_nsname }} name "$3"")}\''
# Bring up all of the namespace interfaces
{%- if HasIFUPAll %}
# Ubuntu seems to not correctly set up the lo iface when calling ifup -a
# Disable it first, before setting it up.
ExecStart=-/sbin/ip netns exec {{ amphora_nsname }} ifdown lo
ExecStart=-/sbin/ip netns exec {{ amphora_nsname }} ifup -a
{%- else %}
ExecStart=-/sbin/ip netns exec {{ amphora_nsname }} ifup lo
ExecStart=-/bin/awk '{system("/sbin/ip netns exec {{ amphora_nsname }} ifup " $2)}' /var/lib/octavia/plugged_interfaces
{%- endif %}

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixed an issue with the ``lo`` interface in the ``amphora-haproxy`` network
namespace. The ``lo`` interface was down and prevented haproxy to
communicate with other haproxy processes (for persistent stick tables) on
configuration change. It delayed old haproxy worker cleanup and increased
the memory consumption usage after reloading the configuration.