From 6ca136bae4c2dab4ff22d4e9614bac59d2b7ba27 Mon Sep 17 00:00:00 2001 From: Phil Sphicas Date: Sat, 16 Nov 2019 00:51:01 -0800 Subject: [PATCH] Ingress chart managed VIP fixes cleanup/startup When the ingress pod (in routed mode, using a managed vip) moves from one host to another, it is sometimes observed that: 1. the vip interface is not removed on the original host, and 2. in some network topologies, the switch fabric is unable to find the new pod. This change updates the ingress deployment as follows: Adds a 5s sleep before the shutdown of the ingress container in order to allow the preStop action of the ingress-vip container to run completely. Updates the start action of the ingress-vip-init container to check if the vip is part of an existing connected subnet, and if so, sends a few gratuitous ARP messages to let the switch fabric to build its ARP cache. Change-Id: I784906865358566f42157dc2133569e4cb270cfa --- ingress/templates/bin/_ingress-controller.sh.tpl | 1 + ingress/templates/bin/_ingress-vip-routed.sh.tpl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ingress/templates/bin/_ingress-controller.sh.tpl b/ingress/templates/bin/_ingress-controller.sh.tpl index a484e98d0..3ba28d6c8 100644 --- a/ingress/templates/bin/_ingress-controller.sh.tpl +++ b/ingress/templates/bin/_ingress-controller.sh.tpl @@ -40,6 +40,7 @@ function start () { } function stop () { + sleep 5 kill -TERM 1 } diff --git a/ingress/templates/bin/_ingress-vip-routed.sh.tpl b/ingress/templates/bin/_ingress-vip-routed.sh.tpl index 3df0053ef..35b5d6cc0 100644 --- a/ingress/templates/bin/_ingress-vip-routed.sh.tpl +++ b/ingress/templates/bin/_ingress-vip-routed.sh.tpl @@ -35,6 +35,11 @@ function start () { ip addr add ${addr} dev ${interface} fi ip link set ${interface} up + garp_interface=$(ip route list match "${addr}" scope link | \ + awk '$2 == "dev" { print $3; exit }') + if [ -n "${garp_interface}" ]; then + arping -U -c 3 -I "${garp_interface}" "${addr%/*}" || true + fi } function sleep () {