diff --git a/templates/common/on-prem/files/keepalived.yaml b/templates/common/on-prem/files/keepalived.yaml index 808d5bc2f5..3d9417d84a 100644 --- a/templates/common/on-prem/files/keepalived.yaml +++ b/templates/common/on-prem/files/keepalived.yaml @@ -90,7 +90,21 @@ contents: done } + remove_vip() + { + address=$1 + interface=$(ip -o a | awk "/\s${address}\// {print \$2}") + cidr=$(ip -o a | awk "/\s${address}\// {print \$4}") + if [ -n "$interface" ]; then + ip a del $cidr dev $interface + fi + } + set -ex + # Ensure that we don't have stale VIPs configured + # See https://bugzilla.redhat.com/show_bug.cgi?id=1931505 + remove_vip "{{ onPremPlatformAPIServerInternalIP . }}" + remove_vip "{{ onPremPlatformIngressIP . }}" declare -r keepalived_sock="/var/run/keepalived/keepalived.sock" export -f msg_handler export -f reload_keepalived @@ -158,4 +172,4 @@ contents: - operator: Exists priorityClassName: system-node-critical status: {} - {{ end -}} \ No newline at end of file + {{ end -}}