From 9d1abc3e904f4c8480c464ea80b6646cc7a965e9 Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Sun, 12 Oct 2025 00:41:04 +0000 Subject: [PATCH] Update env var name. --- internal/data/paths.go | 4 ++-- internal/services/services.go | 2 +- .../setup/cluster-services/cert-manager/install.sh | 10 +++++----- internal/setup/cluster-services/common.sh | 6 +++--- internal/setup/cluster-services/coredns/install.sh | 8 ++++---- .../setup/cluster-services/docker-registry/install.sh | 8 ++++---- internal/setup/cluster-services/externaldns/install.sh | 10 +++++----- .../cluster-services/kubernetes-dashboard/install.sh | 8 ++++---- internal/setup/cluster-services/longhorn/install.sh | 8 ++++---- internal/setup/cluster-services/metallb/install.sh | 8 ++++---- internal/setup/cluster-services/nfs/install.sh | 8 ++++---- .../cluster-services/node-feature-discovery/install.sh | 8 ++++---- .../cluster-services/nvidia-device-plugin/install.sh | 8 ++++---- internal/setup/cluster-services/traefik/install.sh | 8 ++++---- internal/setup/cluster-services/utils/install.sh | 8 ++++---- main.go | 2 +- 16 files changed, 57 insertions(+), 57 deletions(-) diff --git a/internal/data/paths.go b/internal/data/paths.go index d0fcb7e..23fabfc 100644 --- a/internal/data/paths.go +++ b/internal/data/paths.go @@ -37,8 +37,8 @@ func (m *Manager) Initialize() error { if err != nil { return fmt.Errorf("failed to get current directory: %w", err) } - if os.Getenv("WILD_CENTRAL_DATA") != "" { - dataDir = os.Getenv("WILD_CENTRAL_DATA") + if os.Getenv("WILD_API_DATA_DIR") != "" { + dataDir = os.Getenv("WILD_API_DATA_DIR") } else { dataDir = filepath.Join(cwd, "data") } diff --git a/internal/services/services.go b/internal/services/services.go index c196d94..6b0911e 100644 --- a/internal/services/services.go +++ b/internal/services/services.go @@ -554,7 +554,7 @@ func (m *Manager) Deploy(instanceName, serviceName, opID string, broadcaster *op env := os.Environ() env = append(env, fmt.Sprintf("WILD_INSTANCE=%s", instanceName), - fmt.Sprintf("WILD_CENTRAL_DATA=%s", m.dataDir), + fmt.Sprintf("WILD_API_DATA_DIR=%s", m.dataDir), fmt.Sprintf("KUBECONFIG=%s", kubeconfigPath), ) fmt.Printf("[DEBUG] Environment configured: WILD_INSTANCE=%s, KUBECONFIG=%s\n", instanceName, kubeconfigPath) diff --git a/internal/setup/cluster-services/cert-manager/install.sh b/internal/setup/cluster-services/cert-manager/install.sh index 7ca40fb..cec12bc 100755 --- a/internal/setup/cluster-services/cert-manager/install.sh +++ b/internal/setup/cluster-services/cert-manager/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" CERT_MANAGER_DIR="${CLUSTER_SETUP_DIR}/cert-manager" @@ -65,7 +65,7 @@ kubectl wait --for=condition=Available deployment/cert-manager-webhook -n cert-m # Create Cloudflare API token secret # Read token from Wild Central secrets file echo "🔐 Creating Cloudflare API token secret..." -SECRETS_FILE="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}/secrets.yaml" +SECRETS_FILE="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}/secrets.yaml" CLOUDFLARE_API_TOKEN=$(yq '.cloudflare.token' "$SECRETS_FILE" 2>/dev/null) CLOUDFLARE_API_TOKEN=$(echo "$CLOUDFLARE_API_TOKEN") diff --git a/internal/setup/cluster-services/common.sh b/internal/setup/cluster-services/common.sh index 359103d..f716e4d 100644 --- a/internal/setup/cluster-services/common.sh +++ b/internal/setup/cluster-services/common.sh @@ -9,14 +9,14 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA environment variable is not set" +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR environment variable is not set" exit 1 fi # Get the instance directory path get_instance_dir() { - echo "${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" + echo "${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" } # Get the secrets file path diff --git a/internal/setup/cluster-services/coredns/install.sh b/internal/setup/cluster-services/coredns/install.sh index e64a5fd..11bcd32 100755 --- a/internal/setup/cluster-services/coredns/install.sh +++ b/internal/setup/cluster-services/coredns/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" COREDNS_DIR="${CLUSTER_SETUP_DIR}/coredns" diff --git a/internal/setup/cluster-services/docker-registry/install.sh b/internal/setup/cluster-services/docker-registry/install.sh index 55e954e..61841c1 100755 --- a/internal/setup/cluster-services/docker-registry/install.sh +++ b/internal/setup/cluster-services/docker-registry/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" DOCKER_REGISTRY_DIR="${CLUSTER_SETUP_DIR}/docker-registry" diff --git a/internal/setup/cluster-services/externaldns/install.sh b/internal/setup/cluster-services/externaldns/install.sh index df41d26..63a4879 100755 --- a/internal/setup/cluster-services/externaldns/install.sh +++ b/internal/setup/cluster-services/externaldns/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" EXTERNALDNS_DIR="${CLUSTER_SETUP_DIR}/externaldns" @@ -49,7 +49,7 @@ kubectl apply -k ${EXTERNALDNS_DIR}/kustomize # Setup Cloudflare API token secret echo "🔐 Creating Cloudflare API token secret..." -SECRETS_FILE="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}/secrets.yaml" +SECRETS_FILE="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}/secrets.yaml" CLOUDFLARE_API_TOKEN=$(yq '.cloudflare.token' "$SECRETS_FILE" 2>/dev/null | tr -d '"') if [ -z "$CLOUDFLARE_API_TOKEN" ] || [ "$CLOUDFLARE_API_TOKEN" = "null" ]; then diff --git a/internal/setup/cluster-services/kubernetes-dashboard/install.sh b/internal/setup/cluster-services/kubernetes-dashboard/install.sh index 3224f6f..eb4cf02 100755 --- a/internal/setup/cluster-services/kubernetes-dashboard/install.sh +++ b/internal/setup/cluster-services/kubernetes-dashboard/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" KUBERNETES_DASHBOARD_DIR="${CLUSTER_SETUP_DIR}/kubernetes-dashboard" diff --git a/internal/setup/cluster-services/longhorn/install.sh b/internal/setup/cluster-services/longhorn/install.sh index cb64882..8d3793e 100755 --- a/internal/setup/cluster-services/longhorn/install.sh +++ b/internal/setup/cluster-services/longhorn/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" LONGHORN_DIR="${CLUSTER_SETUP_DIR}/longhorn" diff --git a/internal/setup/cluster-services/metallb/install.sh b/internal/setup/cluster-services/metallb/install.sh index 9f08c8e..d981f05 100755 --- a/internal/setup/cluster-services/metallb/install.sh +++ b/internal/setup/cluster-services/metallb/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" METALLB_DIR="${CLUSTER_SETUP_DIR}/metallb" diff --git a/internal/setup/cluster-services/nfs/install.sh b/internal/setup/cluster-services/nfs/install.sh index ec6c20c..973872c 100755 --- a/internal/setup/cluster-services/nfs/install.sh +++ b/internal/setup/cluster-services/nfs/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CONFIG_FILE="${INSTANCE_DIR}/config.yaml" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" NFS_DIR="${CLUSTER_SETUP_DIR}/nfs" diff --git a/internal/setup/cluster-services/node-feature-discovery/install.sh b/internal/setup/cluster-services/node-feature-discovery/install.sh index 3018f82..197fe56 100755 --- a/internal/setup/cluster-services/node-feature-discovery/install.sh +++ b/internal/setup/cluster-services/node-feature-discovery/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" NFD_DIR="${CLUSTER_SETUP_DIR}/node-feature-discovery" diff --git a/internal/setup/cluster-services/nvidia-device-plugin/install.sh b/internal/setup/cluster-services/nvidia-device-plugin/install.sh index 2d40b99..0acfb48 100755 --- a/internal/setup/cluster-services/nvidia-device-plugin/install.sh +++ b/internal/setup/cluster-services/nvidia-device-plugin/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" NVIDIA_PLUGIN_DIR="${CLUSTER_SETUP_DIR}/nvidia-device-plugin" diff --git a/internal/setup/cluster-services/traefik/install.sh b/internal/setup/cluster-services/traefik/install.sh index b7c7154..dcf3c35 100755 --- a/internal/setup/cluster-services/traefik/install.sh +++ b/internal/setup/cluster-services/traefik/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" TRAEFIK_DIR="${CLUSTER_SETUP_DIR}/traefik" diff --git a/internal/setup/cluster-services/utils/install.sh b/internal/setup/cluster-services/utils/install.sh index 0085312..75b274a 100755 --- a/internal/setup/cluster-services/utils/install.sh +++ b/internal/setup/cluster-services/utils/install.sh @@ -8,9 +8,9 @@ if [ -z "${WILD_INSTANCE}" ]; then exit 1 fi -# Ensure WILD_CENTRAL_DATA is set -if [ -z "${WILD_CENTRAL_DATA}" ]; then - echo "❌ ERROR: WILD_CENTRAL_DATA is not set" +# Ensure WILD_API_DATA_DIR is set +if [ -z "${WILD_API_DATA_DIR}" ]; then + echo "❌ ERROR: WILD_API_DATA_DIR is not set" exit 1 fi @@ -20,7 +20,7 @@ if [ -z "${KUBECONFIG}" ]; then exit 1 fi -INSTANCE_DIR="${WILD_CENTRAL_DATA}/instances/${WILD_INSTANCE}" +INSTANCE_DIR="${WILD_API_DATA_DIR}/instances/${WILD_INSTANCE}" CLUSTER_SETUP_DIR="${INSTANCE_DIR}/setup/cluster-services" UTILS_DIR="${CLUSTER_SETUP_DIR}/utils" diff --git a/main.go b/main.go index 3bda96e..bc5b687 100644 --- a/main.go +++ b/main.go @@ -19,7 +19,7 @@ func main() { startTime = time.Now() // Get data directory from environment or use default - dataDir := os.Getenv("WILD_CENTRAL_DATA") + dataDir := os.Getenv("WILD_API_DATA_DIR") if dataDir == "" { dataDir = "/var/lib/wild-central" }