Full cloud setup test run #1 fixes.
This commit is contained in:
@@ -62,40 +62,6 @@ else
|
||||
fi
|
||||
|
||||
print_header "Wild Cloud Cluster Setup"
|
||||
print_info "Setting up cluster infrastructure"
|
||||
echo ""
|
||||
|
||||
# Generate initial cluster configuration
|
||||
|
||||
if ! wild-cluster-config-generate; then
|
||||
print_error "Failed to generate cluster configuration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Configure Talos cli with our new cluster context
|
||||
|
||||
CLUSTER_NAME=$(wild-config "cluster.name")
|
||||
HAS_CONTEXT=$(talosctl config contexts | grep -c "$CLUSTER_NAME" || true)
|
||||
if [ "$HAS_CONTEXT" -eq 0 ]; then
|
||||
print_info "No Talos context found for cluster $CLUSTER_NAME, creating..."
|
||||
talosctl config merge ${WC_HOME}/setup/cluster-nodes/generated/talosconfig
|
||||
talosctl config use "$CLUSTER_NAME"
|
||||
print_success "Talos context for $CLUSTER_NAME created and set as current"
|
||||
fi
|
||||
|
||||
# Talos asset download
|
||||
|
||||
if [ "${SKIP_INSTALLER}" = false ]; then
|
||||
print_header "Installer Image Generation"
|
||||
|
||||
print_info "Running wild-cluster-node-boot-assets-download..."
|
||||
wild-cluster-node-boot-assets-download
|
||||
|
||||
print_success "Installer image generated"
|
||||
echo ""
|
||||
else
|
||||
print_info "Skipping: Installer Image Generation"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Configuration
|
||||
@@ -103,6 +69,9 @@ fi
|
||||
|
||||
prompt_if_unset_config "operator.email" "Operator email address"
|
||||
|
||||
prompt_if_unset_config "cluster.name" "Cluster name" "wild-cluster"
|
||||
CLUSTER_NAME=$(wild-config "cluster.name")
|
||||
|
||||
# Configure hostname prefix for unique node names on LAN
|
||||
prompt_if_unset_config "cluster.hostnamePrefix" "Hostname prefix (optional, e.g. 'test-' for unique names on LAN)" ""
|
||||
HOSTNAME_PREFIX=$(wild-config "cluster.hostnamePrefix")
|
||||
@@ -123,41 +92,41 @@ prompt_if_unset_config "cluster.ipAddressPool" "MetalLB IP address pool" "${SUBN
|
||||
ip_pool=$(wild-config "cluster.ipAddressPool")
|
||||
|
||||
# Load balancer IP (automatically set to first address in the pool if not set)
|
||||
current_lb_ip=$(wild-config "cluster.loadBalancerIp")
|
||||
if [ -z "$current_lb_ip" ] || [ "$current_lb_ip" = "null" ]; then
|
||||
lb_ip=$(echo "${ip_pool}" | cut -d'-' -f1)
|
||||
wild-config-set "cluster.loadBalancerIp" "${lb_ip}"
|
||||
print_info "Set load balancer IP to: ${lb_ip} (first IP in MetalLB pool)"
|
||||
fi
|
||||
default_lb_ip=$(echo "${ip_pool}" | cut -d'-' -f1)
|
||||
prompt_if_unset_config "cluster.loadBalancerIp" "Load balancer IP" "${default_lb_ip}"
|
||||
|
||||
# Talos version
|
||||
prompt_if_unset_config "cluster.nodes.talos.version" "Talos version" "v1.10.4"
|
||||
prompt_if_unset_config "cluster.nodes.talos.version" "Talos version" "v1.11.0"
|
||||
talos_version=$(wild-config "cluster.nodes.talos.version")
|
||||
|
||||
# Talos schematic ID
|
||||
current_schematic_id=$(wild-config "cluster.nodes.talos.schematicId")
|
||||
if [ -z "$current_schematic_id" ] || [ "$current_schematic_id" = "null" ]; then
|
||||
echo ""
|
||||
print_info "Get your Talos schematic ID from: https://factory.talos.dev/"
|
||||
print_info "This customizes Talos with the drivers needed for your hardware."
|
||||
|
||||
# Use current schematic ID from config as default
|
||||
default_schematic_id=$(wild-config "cluster.nodes.talos.schematicId")
|
||||
if [ -n "$default_schematic_id" ] && [ "$default_schematic_id" != "null" ]; then
|
||||
print_info "Using schematic ID from config for Talos $talos_version"
|
||||
else
|
||||
default_schematic_id=""
|
||||
fi
|
||||
|
||||
schematic_id=$(prompt_with_default "Talos schematic ID" "${default_schematic_id}" "${current_schematic_id}")
|
||||
wild-config-set "cluster.nodes.talos.schematicId" "${schematic_id}"
|
||||
fi
|
||||
prompt_if_unset_config "cluster.nodes.talos.schematicId" "Talos schematic ID" "56774e0894c8a3a3a9834a2aea65f24163cacf9506abbcbdc3ba135eaca4953f"
|
||||
schematic_id=$(wild-config "cluster.nodes.talos.schematicId")
|
||||
|
||||
# External DNS
|
||||
cluster_name=$(wild-config "cluster.name")
|
||||
prompt_if_unset_config "cluster.externalDns.ownerId" "External DNS owner ID" "external-dns-${cluster_name}"
|
||||
prompt_if_unset_config "cluster.externalDns.ownerId" "External DNS owner ID" "external-dns-${CLUSTER_NAME}"
|
||||
|
||||
# =============================================================================
|
||||
# TALOS CLUSTER CONFIGURATION
|
||||
# =============================================================================
|
||||
|
||||
prompt_if_unset_config "cluster.nodes.control.vip" "Control plane virtual IP" "${SUBNET_PREFIX}.90"
|
||||
vip=$(wild-config "cluster.nodes.control.vip")
|
||||
|
||||
# Generate initial cluster configuration
|
||||
if ! wild-cluster-config-generate; then
|
||||
print_error "Failed to generate cluster configuration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Configure Talos cli with our new cluster context
|
||||
HAS_CONTEXT=$(talosctl config contexts | grep -c "$CLUSTER_NAME" || true)
|
||||
if [ "$HAS_CONTEXT" -eq 0 ]; then
|
||||
print_info "No Talos context found for cluster $CLUSTER_NAME, creating..."
|
||||
talosctl config merge ${WC_HOME}/setup/cluster-nodes/generated/talosconfig
|
||||
talosctl config context "$CLUSTER_NAME"
|
||||
print_success "Talos context for $CLUSTER_NAME created and set as current"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Node setup
|
||||
@@ -166,12 +135,6 @@ prompt_if_unset_config "cluster.externalDns.ownerId" "External DNS owner ID" "ex
|
||||
if [ "${SKIP_HARDWARE}" = false ]; then
|
||||
|
||||
print_header "Control Plane Configuration"
|
||||
|
||||
print_info "Configure control plane nodes (you need at least 3 for HA):"
|
||||
echo ""
|
||||
|
||||
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)
|
||||
@@ -184,7 +147,6 @@ if [ "${SKIP_HARDWARE}" = false ]; then
|
||||
for i in 1 2 3; do
|
||||
NODE_NAME="${HOSTNAME_PREFIX}control-${i}"
|
||||
TARGET_IP="${vip_prefix}.$(( vip_last_octet + i ))"
|
||||
echo ""
|
||||
print_info "Registering control plane node: $NODE_NAME (IP: $TARGET_IP)"
|
||||
|
||||
# Initialize the node in cluster.nodes.active if not already present
|
||||
@@ -288,14 +250,8 @@ if [ "${SKIP_HARDWARE}" = false ]; then
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".disk" "$SELECTED_DISK"
|
||||
|
||||
# Copy current Talos version and schematic ID to this node
|
||||
current_talos_version=$(wild-config "cluster.nodes.talos.version")
|
||||
current_schematic_id=$(wild-config "cluster.nodes.talos.schematicId")
|
||||
if [ -n "$current_talos_version" ] && [ "$current_talos_version" != "null" ]; then
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".version" "$current_talos_version"
|
||||
fi
|
||||
if [ -n "$current_schematic_id" ] && [ "$current_schematic_id" != "null" ]; then
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".schematicId" "$current_schematic_id"
|
||||
fi
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".version" "$talos_version"
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".schematicId" "$schematic_id"
|
||||
|
||||
echo ""
|
||||
read -p "Bring node $NODE_NAME ($TARGET_IP) up now? (y/N): " -r apply_config
|
||||
@@ -315,7 +271,7 @@ if [ "${SKIP_HARDWARE}" = false ]; then
|
||||
read -p "The cluster should be bootstrapped after the first control node is ready. Is it ready?: " -r is_ready
|
||||
if [[ $is_ready =~ ^[Yy]$ ]]; then
|
||||
print_info "Bootstrapping control plane node $TARGET_IP..."
|
||||
talos config endpoint "$TARGET_IP"
|
||||
talosctl config endpoint "$TARGET_IP"
|
||||
|
||||
# Attempt to bootstrap the cluster
|
||||
if talosctl bootstrap --nodes "$TARGET_IP" 2>&1 | tee /tmp/bootstrap_output.log; then
|
||||
@@ -425,14 +381,8 @@ if [ "${SKIP_HARDWARE}" = false ]; then
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".disk" "$SELECTED_DISK"
|
||||
|
||||
# Copy current Talos version and schematic ID to this node
|
||||
current_talos_version=$(wild-config "cluster.nodes.talos.version")
|
||||
current_schematic_id=$(wild-config "cluster.nodes.talos.schematicId")
|
||||
if [ -n "$current_talos_version" ] && [ "$current_talos_version" != "null" ]; then
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".version" "$current_talos_version"
|
||||
fi
|
||||
if [ -n "$current_schematic_id" ] && [ "$current_schematic_id" != "null" ]; then
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".schematicId" "$current_schematic_id"
|
||||
fi
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".version" "$talos_version"
|
||||
wild-config-set "cluster.nodes.active.\"${NODE_NAME}\".schematicId" "$schematic_id"
|
||||
|
||||
print_success "Worker node $NODE_NAME registered successfully:"
|
||||
print_info " - Name: $NODE_NAME"
|
||||
|
Reference in New Issue
Block a user