Skip to content

Commit

Permalink
Update default route interface lookup:
Browse files Browse the repository at this point in the history
If multiple default routes exists,
we should only use the first one.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
  • Loading branch information
jacobweinstock authored and chrisdoherty4 committed Oct 27, 2023
1 parent d38e9b0 commit 6e104bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tinkerbell/stack/templates/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6e104bc

Please sign in to comment.