- Updated the namespace for the internal wildcard certificate from 'internal' to 'cert-manager'. - Adjusted the DNS zone selectors in Let's Encrypt configurations to use CLOUDFLARE_DOMAIN consistently. - Changed the namespace for the wildcard certificate from 'default' to 'cert-manager'. - Modified ExternalDNS configuration to use OWNER_ID instead of CLUSTER_ID for TXT owner ID. - Cleaned up setup-cert-manager.sh by removing unnecessary internal namespace creation and secret duplication. - Updated certificate wait commands to reflect the new namespace structure. - Simplified the copying of certificates to the example-admin namespace. - Removed test service deployment from setup-externaldns.sh for a cleaner setup process.
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Navigate to script directory
|
|
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
|
|
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# Source environment variables
|
|
if [[ -f "../load-env.sh" ]]; then
|
|
source ../load-env.sh
|
|
fi
|
|
|
|
echo "Setting up ExternalDNS..."
|
|
|
|
# Create externaldns namespace
|
|
kubectl create namespace externaldns --dry-run=client -o yaml | kubectl apply -f -
|
|
|
|
# Setup Cloudflare API token secret for ExternalDNS
|
|
if [[ -n "${CLOUDFLARE_API_TOKEN}" ]]; then
|
|
echo "Creating Cloudflare API token secret..."
|
|
kubectl create secret generic cloudflare-api-token \
|
|
--namespace externaldns \
|
|
--from-literal=api-token="${CLOUDFLARE_API_TOKEN}" \
|
|
--dry-run=client -o yaml | kubectl apply -f -
|
|
else
|
|
echo "Error: CLOUDFLARE_API_TOKEN not set. ExternalDNS will not work correctly."
|
|
exit 1
|
|
fi
|
|
|
|
# Apply ExternalDNS manifests with environment variables
|
|
echo "Deploying ExternalDNS..."
|
|
cat ${SCRIPT_DIR}/externaldns/externaldns.yaml | envsubst | kubectl apply -f -
|
|
|
|
# Wait for ExternalDNS to be ready
|
|
echo "Waiting for ExternalDNS to be ready..."
|
|
kubectl rollout status deployment/external-dns -n externaldns --timeout=60s
|
|
|
|
echo "ExternalDNS setup complete!"
|
|
echo ""
|
|
echo "To verify the installation:"
|
|
echo " kubectl get pods -n externaldns"
|
|
echo " kubectl logs -n externaldns -l app=external-dns -f"
|