core/scripts/04_install_external_dns.sh

27 lines
809 B
Bash
Raw Normal View History

#!/bin/bash
set -e
# Check if the Cloudflare API token is provided as an argument
if [ -z "$1" ]; then
echo "Error: Missing Cloudflare API token."
echo "Usage: $0 <Cloudflare-API-Token>"
echo "You must provide your Cloudflare API token as a parameter to run this script."
exit 1
fi
CLOUDFLARE_API_TOKEN=$1
# Add the Bitnami Helm repository
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
# Create the namespace for 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 -f helm-values/external-dns.yaml \
--set provider=cloudflare \
--set cloudflare.apiToken="$CLOUDFLARE_API_TOKEN" \
--set txtOwnerId=external-dns