From d58eb635d2f484fcfb3aea62646f245c3cfcd426 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Sun, 23 Mar 2025 12:51:54 +0100 Subject: [PATCH] Add MetalLB configuration and resources for Kubernetes --- infrastructure/controllers/kustomization.yaml | 1 + .../controllers/metallb/config-job.yaml | 77 +++++++++++++++++++ .../controllers/metallb/kustomization.yaml | 8 ++ .../controllers/metallb/namespace.yaml | 5 ++ .../controllers/metallb/release.yaml | 20 +++++ .../controllers/metallb/repository.yaml | 9 +++ 6 files changed, 120 insertions(+) create mode 100644 infrastructure/controllers/metallb/config-job.yaml create mode 100644 infrastructure/controllers/metallb/kustomization.yaml create mode 100644 infrastructure/controllers/metallb/namespace.yaml create mode 100644 infrastructure/controllers/metallb/release.yaml create mode 100644 infrastructure/controllers/metallb/repository.yaml diff --git a/infrastructure/controllers/kustomization.yaml b/infrastructure/controllers/kustomization.yaml index 887298d..14bc91d 100644 --- a/infrastructure/controllers/kustomization.yaml +++ b/infrastructure/controllers/kustomization.yaml @@ -2,5 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: + - metallb - cert-manager - traefik diff --git a/infrastructure/controllers/metallb/config-job.yaml b/infrastructure/controllers/metallb/config-job.yaml new file mode 100644 index 0000000..a688714 --- /dev/null +++ b/infrastructure/controllers/metallb/config-job.yaml @@ -0,0 +1,77 @@ +# /infrastructure/controllers/metallb/config-job.yaml +apiVersion: batch/v1 +kind: Job +metadata: + name: metallb-config + namespace: metallb-system +spec: + template: + spec: + serviceAccountName: metallb-config-sa + containers: + - name: kubectl + image: bitnami/kubectl:latest + command: + - /bin/bash + - -c + - | + # Get the external IP of the node using kubectl + SERVER_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}') + + echo "Detected server IP: $SERVER_IP" + + cat <