Standard env init.

This commit is contained in:
2025-06-30 09:16:21 -07:00
parent 8f513235e2
commit 58097f7831
36 changed files with 294 additions and 327 deletions

View File

@@ -45,15 +45,13 @@ if [ -z "${APP_NAME}" ]; then
exit 1
fi
if [ ! -d ".wildcloud" ]; then
echo "Error: .wildcloud directory not found in current directory"
echo "This script must be run from a directory that contains a .wildcloud directory"
exit 1
fi
if [ ! -f ".wildcloud/config.yaml" ]; then
echo "Error: .wildcloud/config.yaml not found"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
CACHE_APP_DIR=".wildcloud/cache/apps/${APP_NAME}"

View File

@@ -61,6 +61,15 @@ if [ ! -d "apps/${APP_NAME}" ]; then
exit 1
fi
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Confirmation prompt (unless --force or --dry-run)
if [ "${FORCE}" != true ] && [ "${DRY_RUN:-}" != "--dry-run=client" ]; then
echo "WARNING: This will delete all resources for app '${APP_NAME}'"

View File

@@ -43,6 +43,15 @@ if [ ! -d "apps/${APP_NAME}" ]; then
exit 1
fi
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Function to deploy secrets for an app
deploy_secrets() {
local app_name="$1"

View File

@@ -7,13 +7,6 @@ KEEP_RESOURCES=false
FOLLOW_LOGS=false
TIMEOUT=120
# Source environment variables from load-env.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="$(dirname "$SCRIPT_DIR")"
if [ -f "$REPO_DIR/load-env.sh" ]; then
source "$REPO_DIR/load-env.sh"
fi
function show_help {
echo "Usage: $0 APP_NAME [options]"
echo ""
@@ -85,6 +78,15 @@ if [[ -z "$APP_NAME" ]]; then
show_help
fi
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Check if doctor directory exists
DOCTOR_DIR="$REPO_DIR/apps/$APP_NAME/doctor"
if [[ ! -d "$DOCTOR_DIR" ]]; then

View File

@@ -45,25 +45,16 @@ if [ -z "${APP_NAME}" ]; then
exit 1
fi
if [ ! -d ".wildcloud" ]; then
echo "Error: .wildcloud directory not found in current directory"
echo "This script must be run from a directory that contains a .wildcloud directory"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
if [ ! -f ".wildcloud/config.yaml" ]; then
echo "Error: .wildcloud/config.yaml not found"
exit 1
fi
WILDCLOUD_REPO=$(yq eval '.wildcloud.repository' .wildcloud/config.yaml)
if [ -z "${WILDCLOUD_REPO}" ] || [ "${WILDCLOUD_REPO}" = "null" ]; then
echo "Error: wildcloud.config not found in .wildcloud/config.yaml"
exit 1
fi
SOURCE_APP_DIR="${WILDCLOUD_REPO}/apps/${APP_NAME}"
SOURCE_APP_DIR="${WC_ROOT}/apps/${APP_NAME}"
if [ ! -d "${SOURCE_APP_DIR}" ]; then
echo "Error: App '${APP_NAME}' not found at ${SOURCE_APP_DIR}"
exit 1

View File

@@ -48,11 +48,16 @@ while [[ $# -gt 0 ]]; do
esac
done
# Get the path to the Wild-Cloud repository (where this script is located)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WILDCLOUD_REPO="$(dirname "${SCRIPT_DIR}")"
APPS_DIR="${WILDCLOUD_REPO}/apps"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
APPS_DIR="${WC_ROOT}/apps"
if [ ! -d "${APPS_DIR}" ]; then
echo "Error: Apps directory not found at ${APPS_DIR}"
exit 1

View File

@@ -3,12 +3,6 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
# Usage function
usage() {
echo "Usage: wild-cluster-config-generate [options]"
@@ -55,18 +49,13 @@ while [[ $# -gt 0 ]]; do
esac
done
# Check if we're in a wild-cloud directory
if [ ! -d ".wildcloud" ]; then
print_error "You must run this script from a wild-cloud directory"
print_info "Run 'wild-setup' or 'wild-init' first to initialize a wild-cloud project"
exit 1
fi
# Check if talosctl is available
if ! command -v talosctl >/dev/null 2>&1; then
print_error "talosctl not found in PATH"
print_info "Please install talosctl to generate cluster configurations"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# =============================================================================

View File

@@ -3,12 +3,6 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
# Usage function
usage() {
echo "Usage: wild-cluster-node-image-create [options]"
@@ -48,11 +42,13 @@ while [[ $# -gt 0 ]]; do
esac
done
# Check if we're in a wild-cloud directory
if [ ! -d ".wildcloud" ]; then
print_error "You must run this script from a wild-cloud directory"
print_info "Run 'wild-setup' or 'wild-init' first to initialize a wild-cloud project"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Configure basic settings if needed

View File

@@ -3,12 +3,6 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
# Usage function
usage() {
echo "Usage: wild-cluster-node-machine-config-generate <node-ip>"
@@ -72,7 +66,14 @@ if [ -z "$NODE_IP" ]; then
exit 1
fi
check_wild_directory
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Check required configuration
if [ -z "$(get_current_config "cluster.name")" ]; then

View File

@@ -3,12 +3,6 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
# Usage function
usage() {
echo "Usage: wild-cluster-node-up <node-ip> [options]"
@@ -84,8 +78,14 @@ if [ -z "$NODE_IP" ]; then
exit 1
fi
# Check if we're in a wild-cloud directory
check_wild_directory
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Check required configuration
if [ -z "$(get_current_config "cluster.name")" ]; then

View File

@@ -3,13 +3,6 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
# Usage function
usage() {
echo "Usage: wild-cluster-services-generate [options]"
@@ -56,18 +49,13 @@ while [[ $# -gt 0 ]]; do
esac
done
# Check if we're in a wild-cloud directory
if [ ! -d ".wildcloud" ]; then
print_error "You must run this script from a wild-cloud directory"
print_info "Run 'wild-setup' or 'wild-init' first to initialize a wild-cloud project"
exit 1
fi
# Check if basic configuration exists
if [ ! -f "${WC_HOME}/config.yaml" ]; then
print_error "Configuration file not found: ${WC_HOME}/config.yaml"
print_info "Run 'wild-setup' first to configure your cluster"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# =============================================================================

View File

@@ -3,13 +3,6 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
# Usage function
usage() {
echo "Usage: wild-cluster-services-up [options] [service...]"
@@ -70,11 +63,13 @@ while [[ $# -gt 0 ]]; do
esac
done
# Check if we're in a wild-cloud directory
if [ ! -d ".wildcloud" ]; then
print_error "You must run this script from a wild-cloud directory"
print_info "Run 'wild-setup' or 'wild-init' first to initialize a wild-cloud project"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"

View File

@@ -37,10 +37,13 @@ while [[ $# -gt 0 ]]; do
esac
done
# Check if WC_HOME is set
if [ -z "${WC_HOME:-}" ]; then
echo "Error: WC_HOME environment variable not set" >&2
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
CONFIG_FILE="${WC_HOME}/config.yaml"

View File

@@ -54,7 +54,6 @@ fi
source_dir="$1"
dest_dir="${2:-${source_dir}_compiled}"
# Validate source directory
if [[ ! -d "$source_dir" ]]; then
echo "Error: Source directory does not exist: $source_dir" >&2

View File

@@ -49,10 +49,13 @@ if [ -z "${KEY_PATH}" ]; then
exit 1
fi
# Check if WC_HOME is set
if [ -z "${WC_HOME:-}" ]; then
echo "Error: WC_HOME environment variable not set" >&2
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
CONFIG_FILE="${WC_HOME}/config.yaml"

View File

@@ -57,10 +57,13 @@ if [ -z "${VALUE}" ]; then
exit 1
fi
# Check if WC_HOME is set
if [ -z "${WC_HOME:-}" ]; then
echo "Error: WC_HOME environment variable not set" >&2
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
CONFIG_FILE="${WC_HOME}/config.yaml"

View File

@@ -17,14 +17,15 @@ while [[ $# -gt 0 ]]; do
esac
done
# Check if WC_HOME is set
if [ -z "${WC_HOME:-}" ]; then
echo "Error: WC_HOME environment variable not set. Run \`source ./env.sh\`."
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
WC_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# ---
SOURCE_DIR="${WC_ROOT}/setup/dnsmasq"

View File

@@ -49,10 +49,13 @@ if [ -z "${KEY_PATH}" ]; then
exit 1
fi
# Check if WC_HOME is set
if [ -z "${WC_HOME:-}" ]; then
echo "Error: WC_HOME environment variable not set" >&2
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
SECRETS_FILE="${WC_HOME}/secrets.yaml"

View File

@@ -57,10 +57,13 @@ if [ -z "${VALUE}" ]; then
exit 1
fi
# Check if WC_HOME is set
if [ -z "${WC_HOME:-}" ]; then
echo "Error: WC_HOME environment variable not set" >&2
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
SECRETS_FILE="${WC_HOME}/secrets.yaml"

View File

@@ -3,18 +3,12 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Parse arguments
# Initialize Wild-Cloud environment
init_wild_env
# Phase tracking variables
SKIP_SCAFFOLD=false
SKIP_CLUSTER=false
SKIP_SERVICES=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--skip-scaffold)
@@ -71,31 +65,37 @@ while [[ $# -gt 0 ]]; do
esac
done
# Set up cloud directory (WC_HOME is where user's cloud will be)
WC_HOME="$(pwd)"
export WC_HOME
# Initialize Wild-Cloud environment
print_header "Wild-Cloud Complete Setup"
print_info "Running complete Wild-Cloud setup using modular components"
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
print_header "Wild-Cloud Setup"
print_info "Running complete Wild-Cloud setup."
echo ""
# =============================================================================
# SCAFFOLD SETUP
# WC_HOME SCAFFOLDING
# =============================================================================
if [ "${SKIP_SCAFFOLD}" = false ]; then
print_header "Component 1: Scaffold Setup"
print_info "Running wild-setup-scaffold..."
print_header "Cloud Home Setup"
print_info "Scaffolding your cloud home..."
if wild-setup-scaffold; then
print_success "Component 1 completed: Scaffold setup"
print_success "Cloud home setup completed"
else
print_error "Component 1 failed: Scaffold setup"
print_error "Cloud home setup failed"
exit 1
fi
echo ""
else
print_info "Skipping Component 1: Scaffold Setup"
print_info "Skipping Component 1: Cloud Home Setup"
fi
# =============================================================================
@@ -103,13 +103,13 @@ fi
# =============================================================================
if [ "${SKIP_CLUSTER}" = false ]; then
print_header "Component 2: Cluster Setup"
print_header "Cluster Setup"
print_info "Running wild-setup-cluster..."
if wild-setup-cluster; then
print_success "Component 2 completed: Cluster setup"
print_success "Cluster setup completed"
else
print_error "Component 2 failed: Cluster setup"
print_error "Cluster setup failed"
exit 1
fi
echo ""
@@ -122,13 +122,13 @@ fi
# =============================================================================
if [ "${SKIP_SERVICES}" = false ]; then
print_header "Component 3: Services Setup"
print_header "Services Setup"
print_info "Running wild-setup-services..."
if wild-setup-services; then
print_success "Component 3 completed: Services setup"
print_success "Services setup completed"
else
print_error "Component 3 failed: Services setup"
print_error "Services setup failed"
exit 1
fi
echo ""
@@ -142,34 +142,6 @@ fi
print_header "Wild-Cloud Complete Setup Finished!"
print_success "All components completed successfully!"
echo ""
print_info "What was accomplished:"
if [ "${SKIP_SCAFFOLD}" = false ]; then
print_info "✅ Component 1: Scaffold setup (cloud initialization)"
else
print_info "⏸️ Component 1: Scaffold setup (skipped)"
fi
if [ "${SKIP_CLUSTER}" = false ]; then
print_info "✅ Component 2: Cluster setup (Phases 1-3)"
else
print_info "⏸️ Component 2: Cluster setup (skipped)"
fi
if [ "${SKIP_SERVICES}" = false ]; then
print_info "✅ Component 3: Services setup (Phase 4)"
else
print_info "⏸️ Component 3: Services setup (skipped)"
fi
echo ""
print_info "Individual components can be run separately:"
echo " - wild-setup-scaffold # Cloud initialization"
echo " - wild-setup-cluster # Cluster infrastructure"
echo " - wild-setup-services # Cluster services"
echo ""
if [ "${SKIP_SERVICES}" = false ] && command -v kubectl >/dev/null 2>&1; then
if [ -f "${WC_HOME}/config.yaml" ]; then

View File

@@ -3,18 +3,12 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Parse arguments
# Initialize Wild-Cloud environment
init_wild_env
# Phase tracking variables
SKIP_INSTALLER=false
SKIP_HARDWARE=false
SKIP_CONFIGS=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--skip-installer)
@@ -62,8 +56,15 @@ while [[ $# -gt 0 ]]; do
esac
done
# Check if we're in a wild-cloud directory
check_wild_directory
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Check basic configuration
check_basic_config
@@ -103,25 +104,11 @@ if [ "${SKIP_HARDWARE}" = false ]; then
GATEWAY_IP=$(ip route | grep default | awk '{print $3; exit}' 2>/dev/null || echo "192.168.1.1")
SUBNET_PREFIX=$(echo "${CURRENT_IP}" | cut -d. -f1-3)
current_router_ip=$(get_current_config "cloud.router.ip")
router_ip=$(prompt_with_default "Router/Gateway IP" "${GATEWAY_IP}" "${current_router_ip}")
wild-config-set "cloud.router.ip" "${router_ip}"
current_dns_ip=$(get_current_config "cloud.dns.ip")
dns_ip=$(prompt_with_default "DNS server IP (dnsmasq machine)" "${SUBNET_PREFIX}.50" "${current_dns_ip}")
wild-config-set "cloud.dns.ip" "${dns_ip}"
current_dhcp_range=$(get_current_config "cloud.dhcpRange")
dhcp_range=$(prompt_with_default "DHCP range for dnsmasq" "${SUBNET_PREFIX}.100,${SUBNET_PREFIX}.200" "${current_dhcp_range}")
wild-config-set "cloud.dhcpRange" "${dhcp_range}"
current_interface=$(get_current_config "cloud.dnsmasq.interface")
interface=$(prompt_with_default "Network interface for dnsmasq" "eth0" "${current_interface}")
wild-config-set "cloud.dnsmasq.interface" "${interface}"
current_external_resolver=$(get_current_config "cloud.dns.externalResolver")
external_resolver=$(prompt_with_default "External DNS resolver" "1.1.1.1" "${current_external_resolver}")
wild-config-set "cloud.dns.externalResolver" "${external_resolver}"
prompt_if_unset_config "cloud.router.ip" "Router/Gateway IP" "${GATEWAY_IP}"
prompt_if_unset_config "cloud.dns.ip" "DNS server IP (dnsmasq machine)" "${SUBNET_PREFIX}.50"
prompt_if_unset_config "cloud.dhcpRange" "DHCP range for dnsmasq" "${SUBNET_PREFIX}.100,${SUBNET_PREFIX}.200"
prompt_if_unset_config "cloud.dnsmasq.interface" "Network interface for dnsmasq" "eth0"
prompt_if_unset_config "cloud.dns.externalResolver" "External DNS resolver" "1.1.1.1"
print_success "Network configuration completed"
echo ""
@@ -134,24 +121,14 @@ if [ "${SKIP_HARDWARE}" = false ]; then
SUBNET_PREFIX=$(echo "${CURRENT_IP}" | cut -d. -f1-3)
# Talos version
current_talos_version=$(get_current_config "cluster.nodes.talos.version")
if [ -z "$current_talos_version" ] || [ "$current_talos_version" = "null" ]; then
talos_version=$(prompt_with_default "Talos version" "v1.10.4" "${current_talos_version}")
wild-config-set "cluster.nodes.talos.version" "${talos_version}"
else
talos_version="$current_talos_version"
fi
prompt_if_unset_config "cluster.nodes.talos.version" "Talos version" "v1.10.4"
talos_version=$(wild-config "cluster.nodes.talos.version")
# MetalLB IP address pool
current_ip_pool=$(get_current_config "cluster.ipAddressPool")
if [ -z "$current_ip_pool" ] || [ "$current_ip_pool" = "null" ]; then
ip_pool=$(prompt_with_default "MetalLB IP address pool" "${SUBNET_PREFIX}.80-${SUBNET_PREFIX}.89" "${current_ip_pool}")
wild-config-set "cluster.ipAddressPool" "${ip_pool}"
else
ip_pool="$current_ip_pool"
fi
prompt_if_unset_config "cluster.ipAddressPool" "MetalLB IP address pool" "${SUBNET_PREFIX}.80-${SUBNET_PREFIX}.89"
ip_pool=$(wild-config "cluster.ipAddressPool")
# Load balancer IP (automatically set to first address in the pool)
# Load balancer IP (automatically set to first address in the pool if not set)
current_lb_ip=$(get_current_config "cluster.loadBalancerIp")
if [ -z "$current_lb_ip" ] || [ "$current_lb_ip" = "null" ]; then
lb_ip=$(echo "${ip_pool}" | cut -d'-' -f1)
@@ -183,12 +160,8 @@ if [ "${SKIP_HARDWARE}" = false ]; then
fi
# External DNS
current_owner_id=$(get_current_config "cluster.externalDns.ownerId")
if [ -z "$current_owner_id" ] || [ "$current_owner_id" = "null" ]; then
cluster_name=$(get_current_config "cluster.name")
owner_id=$(prompt_with_default "External DNS owner ID" "external-dns-${cluster_name}" "${current_owner_id}")
wild-config-set "cluster.externalDns.ownerId" "${owner_id}"
fi
prompt_if_unset_config "cluster.externalDns.ownerId" "External DNS owner ID" "external-dns-${cluster_name}"
print_success "Cluster configuration completed"
echo ""
@@ -208,9 +181,8 @@ if [ "${SKIP_HARDWARE}" = false ]; then
print_info "Configure control plane nodes (you need at least 3 for HA):"
echo ""
current_vip=$(get_current_config "cluster.nodes.control.vip")
vip=$(prompt_with_default "Control plane virtual IP" "${SUBNET_PREFIX}.90" "${current_vip}")
wild-config-set "cluster.nodes.control.vip" "${vip}"
prompt_if_unset_config "cluster.nodes.control.vip" "Control plane virtual IP" "${SUBNET_PREFIX}.90"
vip=$(wild-config "cluster.nodes.control.vip")
# Automatically configure the first three IPs after VIP for control plane nodes
vip_last_octet=$(echo "$vip" | cut -d. -f4)

View File

@@ -3,15 +3,11 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
# Parse arguments
UPDATE=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--update)
@@ -52,19 +48,18 @@ while [[ $# -gt 0 ]]; do
esac
done
# Set up cloud directory (WC_HOME is where user's cloud will be)
WC_HOME="$(pwd)"
export WC_HOME
# Initialize Wild-Cloud environment
# Template directory (in WC_ROOT, never written to)
TEMPLATE_DIR="${WC_ROOT}/setup/home-scaffold"
echo "Using template directory: ${TEMPLATE_DIR}"
if [ ! -d "${TEMPLATE_DIR}" ]; then
echo "Error: Template directory not found at ${TEMPLATE_DIR}"
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
TEMPLATE_DIR="${WC_ROOT}/setup/home-scaffold"
# Check if cloud already exists
if [ -d ".wildcloud" ]; then
echo "Wild-Cloud already exists in this directory."
@@ -164,27 +159,26 @@ if [ ! -f "${WC_HOME}/config.yaml" ] || [ -z "$(get_current_config "operator.ema
echo ""
# Basic Information
current_email=$(get_current_config "operator.email")
email=$(prompt_with_default "Your email address (for Let's Encrypt certificates)" "" "${current_email}")
wild-config-set "operator.email" "${email}"
prompt_if_unset_config "operator.email" "Your email address (for Let's Encrypt certificates)" ""
# Domain Configuration
current_base_domain=$(get_current_config "cloud.baseDomain")
base_domain=$(prompt_with_default "Your base domain name (e.g., example.com)" "" "${current_base_domain}")
wild-config-set "cloud.baseDomain" "${base_domain}"
prompt_if_unset_config "cloud.baseDomain" "Your base domain name (e.g., example.com)" ""
current_domain=$(get_current_config "cloud.domain")
domain=$(prompt_with_default "Your public cloud domain" "cloud.${base_domain}" "${current_domain}")
wild-config-set "cloud.domain" "${domain}"
# Get base domain to use as default for cloud domain
base_domain=$(wild-config "cloud.baseDomain")
prompt_if_unset_config "cloud.domain" "Your public cloud domain" "cloud.${base_domain}"
current_internal_domain=$(get_current_config "cloud.internalDomain")
internal_domain=$(prompt_with_default "Your internal cloud domain" "internal.${domain}" "${current_internal_domain}")
wild-config-set "cloud.internalDomain" "${internal_domain}"
# Get cloud domain to use as default for internal domain
domain=$(wild-config "cloud.domain")
prompt_if_unset_config "cloud.internalDomain" "Your internal cloud domain" "internal.${domain}"
# Derive cluster name from domain
# Derive cluster name from domain if not already set
current_cluster_name=$(get_current_config "cluster.name")
if [ -z "$current_cluster_name" ] || [ "$current_cluster_name" = "null" ]; then
cluster_name=$(echo "${domain}" | tr '.' '-' | tr '[:upper:]' '[:lower:]')
wild-config-set "cluster.name" "${cluster_name}"
print_info "Set cluster name to: ${cluster_name}"
fi
print_success "Basic configuration completed"
echo ""

View File

@@ -3,13 +3,8 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
# Parse arguments
SKIP_INSTALL=false
while [[ $# -gt 0 ]]; do
@@ -53,8 +48,15 @@ while [[ $# -gt 0 ]]; do
esac
done
# Check if we're in a wild-cloud directory
check_wild_directory
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Check basic configuration
check_basic_config

View File

@@ -5,10 +5,13 @@
set -euo pipefail
# Check if WC_HOME is set
if [ -z "${WC_HOME:-}" ]; then
echo "Error: WC_HOME environment variable not set. Run \`source .env\`."
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
CONFIG_FILE="${WC_HOME}/config.yaml"

View File

@@ -6,10 +6,13 @@
set -euo pipefail
# Check if WC_HOME is set
if [ -z "${WC_HOME:-}" ]; then
echo "Error: WC_HOME environment variable not set. Run \`source .env\`."
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
CONFIG_FILE="${WC_HOME}/config.yaml"

View File

@@ -183,19 +183,27 @@ find_wc_home() {
# Initialize common Wild-Cloud environment variables
# Call this function at the beginning of scripts
init_wild_env() {
# Get WC_ROOT (where this script and templates live)
if [ -z "${WC_ROOT}" ]; then
WC_ROOT="$(cd "$(dirname "${BASH_SOURCE[1]}")/.." && pwd)"
export WC_ROOT
print "Fail"
exit 1
else
# Check if WC_ROOT is a valid directory
if [ ! -d "${WC_ROOT}" ]; then
echo "ERROR: WC_ROOT directory does not exist! Did you install the wild-cloud root?"
exit 1
fi
# Set up cloud directory (WC_HOME is where user's cloud is)
# Look for .wildcloud directory in current path or ancestors
# Check if WC_ROOT/bin is in path
if [[ ":$PATH:" != *":$WC_ROOT/bin:"* ]]; then
echo "ERROR: Your wildcloud seed bin path should be in your PATH environment."
exit 1
fi
WC_HOME="$(find_wc_home)"
if [ -z "${WC_HOME}" ]; then
local found_home
if found_home="$(find_wc_home)"; then
WC_HOME="$found_home"
export WC_HOME
echo "ERROR: This command must be run from within a wildcloud home directory."
exit 1
fi
fi
}

View File

@@ -2,13 +2,15 @@
set -e
set -o pipefail
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
source "${WC_ROOT}/bin/wild-common.sh"
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
DOCKER_REGISTRY_DIR="${CLUSTER_SETUP_DIR}/docker-registry"

View File

@@ -2,13 +2,15 @@
set -e
set -o pipefail
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
source "${WC_ROOT}/bin/wild-common.sh"
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
EXTERNALDNS_DIR="${CLUSTER_SETUP_DIR}/externaldns"

View File

@@ -21,12 +21,6 @@ echo
echo "Infrastructure setup complete!"
echo
echo "Next steps:"
echo "1. Install Helm charts for non-infrastructure components"
INTERNAL_DOMAIN=$(wild-config cloud.internalDomain)
echo "2. Access the dashboard at: https://dashboard.${INTERNAL_DOMAIN}"
echo "3. Get the dashboard token with: ./bin/dashboard-token"
echo
echo "To verify components, run:"
echo "- kubectl get pods -n cert-manager"
echo "- kubectl get pods -n externaldns"

View File

@@ -2,13 +2,15 @@
set -e
set -o pipefail
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
source "${WC_ROOT}/bin/wild-common.sh"
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
KUBERNETES_DASHBOARD_DIR="${CLUSTER_SETUP_DIR}/kubernetes-dashboard"

View File

@@ -2,9 +2,13 @@
set -e
set -o pipefail
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
source "${WC_ROOT}/bin/wild-common.sh"

View File

@@ -2,13 +2,15 @@
set -e
set -o pipefail
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
source "${WC_ROOT}/bin/wild-common.sh"
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
METALLB_DIR="${CLUSTER_SETUP_DIR}/metallb"

View File

@@ -2,13 +2,15 @@
set -e
set -o pipefail
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
source "${WC_ROOT}/bin/wild-common.sh"
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
NFS_DIR="${CLUSTER_SETUP_DIR}/nfs"

View File

@@ -2,13 +2,15 @@
set -e
set -o pipefail
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
source "${WC_ROOT}/bin/wild-common.sh"
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
TRAEFIK_DIR="${CLUSTER_SETUP_DIR}/traefik"

View File

@@ -2,13 +2,15 @@
set -e
set -o pipefail
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
source "${WC_ROOT}/bin/wild-common.sh"
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
UTILS_DIR="${CLUSTER_SETUP_DIR}/utils"

View File

@@ -1,10 +1,13 @@
#!/bin/bash
set -e
# Check if WC_HOME is set (wildcloud environment sourced)
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
# Initialize Wild-Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
# Navigate to script directory