From 6e104bcb02e625f0273f4041da4d4b04436b2e4c Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Wed, 18 Oct 2023 20:05:27 -0600 Subject: [PATCH] Update default route interface lookup: If multiple default routes exists, we should only use the first one. Signed-off-by: Jacob Weinstock --- tinkerbell/stack/templates/nginx.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinkerbell/stack/templates/nginx.yaml b/tinkerbell/stack/templates/nginx.yaml index eefd99a2..2896c647 100644 --- a/tinkerbell/stack/templates/nginx.yaml +++ b/tinkerbell/stack/templates/nginx.yaml @@ -116,7 +116,7 @@ spec: # if sourceInterface is not set use the interface from the default route srcInterface="{{ $sourceInterface }}" if [ -z "$srcInterface" ]; then - srcInterface=$(nsenter -t1 -n ip route | awk '/default/ {print $5}') + srcInterface=$(nsenter -t1 -n ip route | awk '/default/ {print $5}' | head -n1) fi # Create a macvlan interface. TODO: If this fails, try again with a different name? nsenter -t1 -n ip link add {{ $macvlanInterfaceName }} link ${srcInterface} type macvlan mode bridge