Updates service installs to not copy kustomize templates.
This commit is contained in:
@@ -72,17 +72,12 @@ if [ -z "$NODE_IP" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 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_wild_directory
|
||||
|
||||
# Check required configuration
|
||||
if [ -z "$(get_current_config "cluster.name")" ]; then
|
||||
print_error "Basic cluster configuration is missing"
|
||||
print_info "Run 'wild-setup' or 'wild-init' first to configure your cluster"
|
||||
print_info "Run 'wild-setup' to configure your cluster"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@@ -102,34 +102,71 @@ elif [ "$FORCE" = true ] && [ -d "$DEST_DIR" ]; then
|
||||
rm -rf "$DEST_DIR"
|
||||
fi
|
||||
|
||||
# Copy cluster setup files
|
||||
print_info "Copying cluster setup files from repository..."
|
||||
# Copy and compile cluster setup files
|
||||
print_info "Copying and compiling cluster setup files from repository..."
|
||||
mkdir -p "${WC_HOME}/setup"
|
||||
cp -r "$SOURCE_DIR" "$DEST_DIR"
|
||||
|
||||
# Copy README if it doesn't exist
|
||||
if [ ! -f "${WC_HOME}/setup/README.md" ]; then
|
||||
cp "${WC_ROOT}/setup/README.md" "${WC_HOME}/setup/README.md"
|
||||
fi
|
||||
|
||||
print_success "Cluster setup files copied"
|
||||
# Create destination directory
|
||||
mkdir -p "$DEST_DIR"
|
||||
|
||||
# Compile templates
|
||||
print_info "Compiling service templates with current configuration..."
|
||||
# First, copy root-level files from setup/cluster/ (install-all.sh, get_helm.sh, etc.)
|
||||
print_info "Copying root-level cluster setup files..."
|
||||
for item in "$SOURCE_DIR"/*; do
|
||||
if [ -f "$item" ]; then
|
||||
item_name=$(basename "$item")
|
||||
print_info " Copying: ${item_name}"
|
||||
cp "$item" "$DEST_DIR/$item_name"
|
||||
fi
|
||||
done
|
||||
|
||||
COMPILED_COUNT=0
|
||||
find "$DEST_DIR" -type f \( -name "*.yaml" -o -name "*.yml" -o -name "*.conf" -o -name "*.json" \) | while read -r file; do
|
||||
# Skip files that don't contain template variables
|
||||
if ! grep -q "{{" "$file" 2>/dev/null; then
|
||||
# Then, process each service directory in the source
|
||||
print_info "Processing service directories..."
|
||||
for service_dir in "$SOURCE_DIR"/*; do
|
||||
if [ ! -d "$service_dir" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
print_info "Compiling: ${file#${WC_HOME}/}"
|
||||
wild-compile-template < "$file" > "${file}.tmp" && mv "${file}.tmp" "$file"
|
||||
COMPILED_COUNT=$((COMPILED_COUNT + 1))
|
||||
service_name=$(basename "$service_dir")
|
||||
dest_service_dir="$DEST_DIR/$service_name"
|
||||
|
||||
print_info "Processing service: $service_name"
|
||||
|
||||
# Create destination service directory
|
||||
mkdir -p "$dest_service_dir"
|
||||
|
||||
# Copy all files except kustomize.template directory
|
||||
for item in "$service_dir"/*; do
|
||||
item_name=$(basename "$item")
|
||||
|
||||
if [ "$item_name" = "kustomize.template" ]; then
|
||||
# Compile kustomize.template to kustomize directory
|
||||
if [ -d "$item" ]; then
|
||||
print_info " Compiling kustomize templates for $service_name"
|
||||
wild-compile-template-dir --clean "$item" "$dest_service_dir/kustomize"
|
||||
fi
|
||||
else
|
||||
# Copy other files as-is (install.sh, README.md, etc.)
|
||||
if [ -f "$item" ]; then
|
||||
# Compile individual template files
|
||||
if grep -q "{{" "$item" 2>/dev/null; then
|
||||
print_info " Compiling: ${item_name}"
|
||||
wild-compile-template < "$item" > "$dest_service_dir/$item_name"
|
||||
else
|
||||
cp "$item" "$dest_service_dir/$item_name"
|
||||
fi
|
||||
elif [ -d "$item" ]; then
|
||||
cp -r "$item" "$dest_service_dir/"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
print_success "Template compilation completed"
|
||||
print_success "Cluster setup files copied and compiled"
|
||||
|
||||
# Verify required configuration
|
||||
print_info "Verifying service configuration..."
|
||||
|
@@ -58,6 +58,7 @@ export WC_HOME
|
||||
|
||||
# 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}"
|
||||
|
@@ -72,10 +72,10 @@ print_info "Installing Kubernetes cluster services (Phase 4)"
|
||||
echo ""
|
||||
|
||||
# =============================================================================
|
||||
# PHASE 4: Cluster Services Installation
|
||||
# Cluster Services Installation
|
||||
# =============================================================================
|
||||
|
||||
print_header "Phase 4: Cluster Services Installation"
|
||||
print_header "Cluster Services Installation"
|
||||
|
||||
# Configure DNS and certificates
|
||||
if [ -z "$(get_current_config "cluster.certManager.cloudflare.domain")" ]; then
|
||||
@@ -115,7 +115,55 @@ if [ -z "$(get_current_config "cluster.certManager.cloudflare.domain")" ]; then
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Configure storage settings
|
||||
# Configure core network settings
|
||||
print_header "Network Configuration"
|
||||
|
||||
# Get basic domain configuration (should already be set from earlier setup)
|
||||
domain=$(get_current_config "cloud.domain")
|
||||
internal_domain=$(get_current_config "cloud.internalDomain")
|
||||
operator_email=$(get_current_config "operator.email")
|
||||
|
||||
if [ -z "$domain" ] || [ -z "$internal_domain" ] || [ -z "$operator_email" ]; then
|
||||
print_error "Basic domain and operator configuration missing"
|
||||
print_info "Please run 'wild-setup-scaffold' first to configure basic settings"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load balancer IP configuration
|
||||
current_lb_ip=$(get_current_config "cluster.loadBalancerIp")
|
||||
if [ -z "$current_lb_ip" ] || [ "$current_lb_ip" = "null" ]; then
|
||||
lb_ip=$(prompt_with_default "Load balancer IP address" "" "${current_lb_ip}")
|
||||
wild-config-set "cluster.loadBalancerIp" "${lb_ip}"
|
||||
fi
|
||||
|
||||
# IP address pool for MetalLB
|
||||
current_ip_pool=$(get_current_config "cluster.ipAddressPool")
|
||||
if [ -z "$current_ip_pool" ] || [ "$current_ip_pool" = "null" ]; then
|
||||
current_lb_ip=$(get_current_config "cluster.loadBalancerIp")
|
||||
ip_pool=$(prompt_with_default "IP address pool for load balancer (range)" "${current_lb_ip}-${current_lb_ip}" "${current_ip_pool}")
|
||||
wild-config-set "cluster.ipAddressPool" "${ip_pool}"
|
||||
fi
|
||||
|
||||
# External DNS resolver for CoreDNS
|
||||
current_dns_resolver=$(get_current_config "cloud.dns.externalResolver")
|
||||
if [ -z "$current_dns_resolver" ] || [ "$current_dns_resolver" = "null" ]; then
|
||||
dns_resolver=$(prompt_with_default "External DNS resolver" "1.1.1.1" "${current_dns_resolver}")
|
||||
wild-config-set "cloud.dns.externalResolver" "${dns_resolver}"
|
||||
fi
|
||||
|
||||
# ExternalDNS owner ID (unique identifier for DNS records)
|
||||
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")
|
||||
default_owner_id="${cluster_name:-wild-cloud}-$(date +%s)"
|
||||
owner_id=$(prompt_with_default "ExternalDNS owner ID (unique identifier)" "${default_owner_id}" "${current_owner_id}")
|
||||
wild-config-set "cluster.externalDns.ownerId" "${owner_id}"
|
||||
fi
|
||||
|
||||
print_success "Network configuration completed"
|
||||
echo ""
|
||||
|
||||
# Configure storage settings
|
||||
print_header "Storage Configuration"
|
||||
|
||||
dns_ip=$(get_current_config "cloud.dns.ip")
|
||||
@@ -181,9 +229,9 @@ else
|
||||
fi
|
||||
|
||||
if [ "${SKIP_INSTALL}" = false ] && [ "${SERVICES_INSTALLED:-false}" = true ]; then
|
||||
print_success "Phase 4 completed: Cluster services installation"
|
||||
print_success "Completed: Cluster services installation"
|
||||
else
|
||||
print_success "Phase 4 completed: Cluster services configuration generated"
|
||||
print_success "Completed: Cluster services configuration generated"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
Reference in New Issue
Block a user