From 27f1df27a8f4a9cbe04e24f0e788c4b59b006f76 Mon Sep 17 00:00:00 2001 From: "Guillaume B.B. Van Hemmen" Date: Fri, 27 Dec 2024 14:55:28 +0100 Subject: [PATCH] #0000 - Refine external-dns setup with error handling and Helm values Replaced `set -ex` with `set -e` for cleaner error output and added Helm values configuration. Ensured namespace creation doesn't fail if it already exists, and specified a custom values file for better deployment flexibility. --- helm-values/external-dns.yaml | 8 ++++++++ scripts/04_install_external_dns.sh | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 helm-values/external-dns.yaml mode change 100644 => 100755 scripts/04_install_external_dns.sh diff --git a/helm-values/external-dns.yaml b/helm-values/external-dns.yaml new file mode 100644 index 0000000..9babe00 --- /dev/null +++ b/helm-values/external-dns.yaml @@ -0,0 +1,8 @@ +nodeSelector: + com.van-hemmen.role: gateway + com.van-hemmen.hosting: ovh +tolerations: + - key: "com.van-hemmen.role" + operator: "Equal" + value: "gateway" + effect: "NoSchedule" diff --git a/scripts/04_install_external_dns.sh b/scripts/04_install_external_dns.sh old mode 100644 new mode 100755 index 098b81a..05e87a4 --- a/scripts/04_install_external_dns.sh +++ b/scripts/04_install_external_dns.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -ex +set -e # Check if the Cloudflare API token is provided as an argument if [ -z "$1" ]; then @@ -17,10 +17,10 @@ helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update # Create the namespace for external DNS -kubectl create namespace external-dns +kubectl create namespace external-dns || true # Install the external-dns chart with the provided Cloudflare API token -helm install external-dns bitnami/external-dns --namespace external-dns \ +helm install external-dns bitnami/external-dns --namespace external-dns -f helm-values/external-dns.yaml \ --set provider=cloudflare \ --set cloudflare.apiToken="$CLOUDFLARE_API_TOKEN" \ --set txtOwnerId=external-dns