From ef2837744184cbfb2f4d3207343c9983366ab6f5 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Sun, 23 Mar 2025 13:12:52 +0100 Subject: [PATCH] Add fallback to internal address to metallb config job --- infrastructure/controllers/metallb/config-job.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/infrastructure/controllers/metallb/config-job.yaml b/infrastructure/controllers/metallb/config-job.yaml index a688714..aab9974 100644 --- a/infrastructure/controllers/metallb/config-job.yaml +++ b/infrastructure/controllers/metallb/config-job.yaml @@ -17,8 +17,19 @@ spec: - | # Get the external IP of the node using kubectl SERVER_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}') + + # Fallback to other address types if ExternalIP isn't available + if [ -z "$SERVER_IP" ]; then + echo "ExternalIP not found, trying InternalIP..." + SERVER_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') + fi echo "Detected server IP: $SERVER_IP" + + if [ -z "$SERVER_IP" ]; then + echo "No external IP found for the node" + exit 1 + fi cat <