Refactor configuration scripts for improved clarity and structure; remove deprecated Talos ISO script and update Talos schemas with new version mappings.
This commit is contained in:
@@ -51,77 +51,15 @@ else
|
|||||||
init_wild_env
|
init_wild_env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure basic settings if needed
|
# Check for required configuration
|
||||||
if [ ! -f "${WC_HOME}/config.yaml" ] || [ -z "$(get_current_config "operator.email")" ]; then
|
|
||||||
print_header "Basic Configuration"
|
|
||||||
|
|
||||||
# Detect current network for suggestions
|
|
||||||
CURRENT_IP=$(ip route get 8.8.8.8 | awk '{print $7; exit}' 2>/dev/null || echo "192.168.1.100")
|
|
||||||
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)
|
|
||||||
print_info "Detected network: ${SUBNET_PREFIX}.x (gateway: ${GATEWAY_IP})"
|
|
||||||
|
|
||||||
echo "This will configure basic settings for your wild-cloud deployment."
|
|
||||||
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}"
|
|
||||||
|
|
||||||
# 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}"
|
|
||||||
|
|
||||||
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}"
|
|
||||||
|
|
||||||
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}"
|
|
||||||
|
|
||||||
# Derive cluster name from domain
|
|
||||||
cluster_name=$(echo "${domain}" | tr '.' '-' | tr '[:upper:]' '[:lower:]')
|
|
||||||
wild-config-set "cluster.name" "${cluster_name}"
|
|
||||||
print_info "Set cluster name to: ${cluster_name}"
|
|
||||||
|
|
||||||
print_success "Basic configuration completed"
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configure cluster settings if needed
|
|
||||||
if [ -z "$(get_current_config "cluster.nodes.talos.version")" ] || [ -z "$(get_current_config "cluster.nodes.talos.schematicId")" ]; then
|
if [ -z "$(get_current_config "cluster.nodes.talos.version")" ] || [ -z "$(get_current_config "cluster.nodes.talos.schematicId")" ]; then
|
||||||
print_header "Kubernetes Cluster Configuration"
|
print_header "Talos Configuration Required"
|
||||||
|
print_error "Missing required Talos configuration"
|
||||||
current_talos_version=$(get_current_config "cluster.nodes.talos.version")
|
print_info "Please run 'wild-setup' first to configure your cluster"
|
||||||
talos_version=$(prompt_with_default "Talos version" "v1.10.4" "${current_talos_version}")
|
print_info "Or set the required configuration manually:"
|
||||||
wild-config-set "cluster.nodes.talos.version" "${talos_version}"
|
print_info " wild-config-set cluster.nodes.talos.version v1.10.4"
|
||||||
|
print_info " wild-config-set cluster.nodes.talos.schematicId YOUR_SCHEMATIC_ID"
|
||||||
# Talos schematic ID
|
exit 1
|
||||||
current_schematic_id=$(get_current_config "cluster.nodes.talos.schematicId")
|
|
||||||
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."
|
|
||||||
|
|
||||||
# Look up default schematic ID from talos-schemas.yaml
|
|
||||||
default_schematic_id=""
|
|
||||||
schemas_file="${WC_ROOT}/setup/cluster-nodes/talos-schemas.yaml"
|
|
||||||
if [ -f "$schemas_file" ]; then
|
|
||||||
default_schematic_id=$(yq eval ".talos-schemas.\"${talos_version}\"" "$schemas_file" 2>/dev/null)
|
|
||||||
if [ -n "$default_schematic_id" ] && [ "$default_schematic_id" != "null" ]; then
|
|
||||||
print_info "Default schematic ID available for Talos $talos_version"
|
|
||||||
else
|
|
||||||
default_schematic_id=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
schematic_id=$(prompt_with_default "Talos schematic ID" "${default_schematic_id}" "${current_schematic_id}")
|
|
||||||
wild-config-set "cluster.nodes.talos.schematicId" "${schematic_id}"
|
|
||||||
|
|
||||||
print_success "Cluster configuration completed"
|
|
||||||
echo ""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -137,35 +75,11 @@ SCHEMATIC_ID=$(get_current_config cluster.nodes.talos.schematicId)
|
|||||||
print_info "Creating custom Talos installer image..."
|
print_info "Creating custom Talos installer image..."
|
||||||
print_info "Talos version: $TALOS_VERSION"
|
print_info "Talos version: $TALOS_VERSION"
|
||||||
|
|
||||||
# Check if schematic ID exists
|
# Validate schematic ID
|
||||||
if [ -z "$SCHEMATIC_ID" ] || [ "$SCHEMATIC_ID" = "null" ]; then
|
if [ -z "$SCHEMATIC_ID" ] || [ "$SCHEMATIC_ID" = "null" ]; then
|
||||||
print_error "No schematic ID found in config.yaml"
|
print_error "No schematic ID found in config.yaml"
|
||||||
print_info "You can get a schematic ID from: https://factory.talos.dev/"
|
print_info "Please run 'wild-setup' first to configure your cluster"
|
||||||
|
|
||||||
# Look up default schematic ID from talos-schemas.yaml
|
|
||||||
fallback_default=""
|
|
||||||
schemas_file="${WC_ROOT}/setup/cluster-nodes/talos-schemas.yaml"
|
|
||||||
if [ -f "$schemas_file" ]; then
|
|
||||||
fallback_default=$(yq eval ".talos-schemas.\"${TALOS_VERSION}\"" "$schemas_file" 2>/dev/null)
|
|
||||||
if [ -n "$fallback_default" ] && [ "$fallback_default" != "null" ]; then
|
|
||||||
print_info "Default schematic ID available for Talos $TALOS_VERSION"
|
|
||||||
read -p "Enter schematic ID [$fallback_default]: " -r SCHEMATIC_ID
|
|
||||||
if [ -z "$SCHEMATIC_ID" ]; then
|
|
||||||
SCHEMATIC_ID="$fallback_default"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
read -p "Enter schematic ID: " -r SCHEMATIC_ID
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
read -p "Enter schematic ID: " -r SCHEMATIC_ID
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$SCHEMATIC_ID" ]; then
|
|
||||||
wild-config-set "cluster.nodes.talos.schematicId" "$SCHEMATIC_ID"
|
|
||||||
else
|
|
||||||
print_error "Schematic ID required for installer image generation"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_info "Schematic ID: $SCHEMATIC_ID"
|
print_info "Schematic ID: $SCHEMATIC_ID"
|
||||||
@@ -190,12 +104,15 @@ print_info "Installer URL: $INSTALLER_URL"
|
|||||||
|
|
||||||
print_header "Downloading and Caching PXE Boot Assets"
|
print_header "Downloading and Caching PXE Boot Assets"
|
||||||
|
|
||||||
# Create cache directories
|
# Create cache directories organized by schematic ID
|
||||||
CACHE_DIR="${WC_HOME}/.wildcloud"
|
CACHE_DIR="${WC_HOME}/.wildcloud"
|
||||||
PXE_CACHE_DIR="${CACHE_DIR}/pxe"
|
SCHEMATIC_CACHE_DIR="${CACHE_DIR}/node-boot-assets/${SCHEMATIC_ID}"
|
||||||
IPXE_CACHE_DIR="${CACHE_DIR}/ipxe"
|
PXE_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/pxe"
|
||||||
|
IPXE_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/ipxe"
|
||||||
|
ISO_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/iso"
|
||||||
mkdir -p "$PXE_CACHE_DIR/amd64"
|
mkdir -p "$PXE_CACHE_DIR/amd64"
|
||||||
mkdir -p "$IPXE_CACHE_DIR"
|
mkdir -p "$IPXE_CACHE_DIR"
|
||||||
|
mkdir -p "$ISO_CACHE_DIR"
|
||||||
|
|
||||||
# Download Talos kernel and initramfs for PXE boot
|
# Download Talos kernel and initramfs for PXE boot
|
||||||
print_info "Downloading Talos PXE assets..."
|
print_info "Downloading Talos PXE assets..."
|
||||||
@@ -248,19 +165,30 @@ download_asset "http://boot.ipxe.org/ipxe.efi" "${IPXE_CACHE_DIR}/ipxe.efi" "iPX
|
|||||||
download_asset "http://boot.ipxe.org/undionly.kpxe" "${IPXE_CACHE_DIR}/undionly.kpxe" "iPXE BIOS bootloader"
|
download_asset "http://boot.ipxe.org/undionly.kpxe" "${IPXE_CACHE_DIR}/undionly.kpxe" "iPXE BIOS bootloader"
|
||||||
download_asset "http://boot.ipxe.org/arm64-efi/ipxe.efi" "${IPXE_CACHE_DIR}/ipxe-arm64.efi" "iPXE ARM64 EFI bootloader"
|
download_asset "http://boot.ipxe.org/arm64-efi/ipxe.efi" "${IPXE_CACHE_DIR}/ipxe-arm64.efi" "iPXE ARM64 EFI bootloader"
|
||||||
|
|
||||||
|
# Download Talos ISO
|
||||||
|
print_info "Downloading Talos ISO..."
|
||||||
|
ISO_URL="https://factory.talos.dev/image/${SCHEMATIC_ID}/${TALOS_VERSION}/metal-amd64.iso"
|
||||||
|
ISO_FILENAME="talos-${TALOS_VERSION}-metal-amd64.iso"
|
||||||
|
ISO_PATH="${ISO_CACHE_DIR}/${ISO_FILENAME}"
|
||||||
|
download_asset "$ISO_URL" "$ISO_PATH" "Talos ISO"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
print_success "All assets downloaded and cached!"
|
print_success "All assets downloaded and cached!"
|
||||||
echo ""
|
echo ""
|
||||||
print_info "Cached assets:"
|
print_info "Cached assets for schematic $SCHEMATIC_ID:"
|
||||||
echo " Talos kernel: $KERNEL_PATH"
|
echo " Talos kernel: $KERNEL_PATH"
|
||||||
echo " Talos initramfs: $INITRAMFS_PATH"
|
echo " Talos initramfs: $INITRAMFS_PATH"
|
||||||
|
echo " Talos ISO: $ISO_PATH"
|
||||||
echo " iPXE EFI: ${IPXE_CACHE_DIR}/ipxe.efi"
|
echo " iPXE EFI: ${IPXE_CACHE_DIR}/ipxe.efi"
|
||||||
echo " iPXE BIOS: ${IPXE_CACHE_DIR}/undionly.kpxe"
|
echo " iPXE BIOS: ${IPXE_CACHE_DIR}/undionly.kpxe"
|
||||||
echo " iPXE ARM64: ${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
echo " iPXE ARM64: ${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
||||||
echo ""
|
echo ""
|
||||||
print_info "Use this URL for:"
|
print_info "Cache location: $SCHEMATIC_CACHE_DIR"
|
||||||
echo " - PXE boot configuration (update boot.ipxe kernel line)"
|
echo ""
|
||||||
echo " - ISO creation: curl -LO https://$INSTALLER_URL"
|
print_info "Use these assets for:"
|
||||||
echo " - USB creation: dd if=talos-installer.iso of=/dev/sdX"
|
echo " - PXE boot: Use kernel and initramfs from cache"
|
||||||
|
echo " - USB creation: Use ISO file for dd or imaging tools"
|
||||||
|
echo " Example: sudo dd if=$ISO_PATH of=/dev/sdX bs=4M status=progress"
|
||||||
|
echo " - Custom installer: https://$INSTALLER_URL"
|
||||||
echo ""
|
echo ""
|
||||||
print_success "Installer image generation and asset caching completed!"
|
print_success "Installer image generation and asset caching completed!"
|
@@ -2,16 +2,22 @@
|
|||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
INSTALL_MODE=false
|
INSTALL_MODE=false
|
||||||
|
SCHEMATIC_ID_OVERRIDE=""
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--install)
|
--install)
|
||||||
INSTALL_MODE=true
|
INSTALL_MODE=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--schematic-id)
|
||||||
|
SCHEMATIC_ID_OVERRIDE="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown option: $1"
|
echo "Unknown option: $1"
|
||||||
echo "Usage: $0 [--install]"
|
echo "Usage: $0 [--install] [--schematic-id SCHEMATIC_ID]"
|
||||||
echo " --install Copy bundle to DNSMasq server and run installation"
|
echo " --install Copy bundle to DNSMasq server and run installation"
|
||||||
|
echo " --schematic-id ID Use specific schematic ID instead of config default"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -68,17 +74,33 @@ PXE_WEB_ROOT="${BUNDLE_DIR}/ipxe-web"
|
|||||||
mkdir -p "${PXE_WEB_ROOT}/amd64"
|
mkdir -p "${PXE_WEB_ROOT}/amd64"
|
||||||
cp "${DNSMASQ_SETUP_DIR}/boot.ipxe" "${PXE_WEB_ROOT}/boot.ipxe"
|
cp "${DNSMASQ_SETUP_DIR}/boot.ipxe" "${PXE_WEB_ROOT}/boot.ipxe"
|
||||||
|
|
||||||
# Define cache directories
|
# Get schematic ID from override or config
|
||||||
|
if [ -n "$SCHEMATIC_ID_OVERRIDE" ]; then
|
||||||
|
SCHEMATIC_ID="$SCHEMATIC_ID_OVERRIDE"
|
||||||
|
echo "Using schematic ID from command line: $SCHEMATIC_ID"
|
||||||
|
else
|
||||||
|
SCHEMATIC_ID=$(wild-config cluster.nodes.talos.schematicId)
|
||||||
|
if [ -z "$SCHEMATIC_ID" ] || [ "$SCHEMATIC_ID" = "null" ]; then
|
||||||
|
echo "Error: No schematic ID found in config"
|
||||||
|
echo "Please run 'wild-setup' first to configure your cluster"
|
||||||
|
echo "Or specify one with --schematic-id option"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Using schematic ID from config: $SCHEMATIC_ID"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define cache directories using new structure
|
||||||
CACHE_DIR="${WC_HOME}/.wildcloud"
|
CACHE_DIR="${WC_HOME}/.wildcloud"
|
||||||
PXE_CACHE_DIR="${CACHE_DIR}/pxe"
|
SCHEMATIC_CACHE_DIR="${CACHE_DIR}/node-boot-assets/${SCHEMATIC_ID}"
|
||||||
IPXE_CACHE_DIR="${CACHE_DIR}/ipxe"
|
PXE_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/pxe"
|
||||||
|
IPXE_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/ipxe"
|
||||||
|
|
||||||
# Check if cached assets exist
|
# Check if cached assets exist
|
||||||
KERNEL_CACHE_PATH="${PXE_CACHE_DIR}/amd64/vmlinuz"
|
KERNEL_CACHE_PATH="${PXE_CACHE_DIR}/amd64/vmlinuz"
|
||||||
INITRAMFS_CACHE_PATH="${PXE_CACHE_DIR}/amd64/initramfs.xz"
|
INITRAMFS_CACHE_PATH="${PXE_CACHE_DIR}/amd64/initramfs.xz"
|
||||||
|
|
||||||
if [ ! -f "${KERNEL_CACHE_PATH}" ] || [ ! -f "${INITRAMFS_CACHE_PATH}" ]; then
|
if [ ! -f "${KERNEL_CACHE_PATH}" ] || [ ! -f "${INITRAMFS_CACHE_PATH}" ]; then
|
||||||
echo "Error: Talos PXE assets not found in cache"
|
echo "Error: Talos PXE assets not found in cache for schematic ID: ${SCHEMATIC_ID}"
|
||||||
echo "Expected locations:"
|
echo "Expected locations:"
|
||||||
echo " Kernel: ${KERNEL_CACHE_PATH}"
|
echo " Kernel: ${KERNEL_CACHE_PATH}"
|
||||||
echo " Initramfs: ${INITRAMFS_CACHE_PATH}"
|
echo " Initramfs: ${INITRAMFS_CACHE_PATH}"
|
||||||
@@ -107,7 +129,7 @@ IPXE_BIOS_CACHE="${IPXE_CACHE_DIR}/undionly.kpxe"
|
|||||||
IPXE_ARM64_CACHE="${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
IPXE_ARM64_CACHE="${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
||||||
|
|
||||||
if [ ! -f "${IPXE_EFI_CACHE}" ] || [ ! -f "${IPXE_BIOS_CACHE}" ] || [ ! -f "${IPXE_ARM64_CACHE}" ]; then
|
if [ ! -f "${IPXE_EFI_CACHE}" ] || [ ! -f "${IPXE_BIOS_CACHE}" ] || [ ! -f "${IPXE_ARM64_CACHE}" ]; then
|
||||||
echo "Error: iPXE bootloader assets not found in cache"
|
echo "Error: iPXE bootloader assets not found in cache for schematic ID: ${SCHEMATIC_ID}"
|
||||||
echo "Expected locations:"
|
echo "Expected locations:"
|
||||||
echo " iPXE EFI: ${IPXE_EFI_CACHE}"
|
echo " iPXE EFI: ${IPXE_EFI_CACHE}"
|
||||||
echo " iPXE BIOS: ${IPXE_BIOS_CACHE}"
|
echo " iPXE BIOS: ${IPXE_BIOS_CACHE}"
|
||||||
|
@@ -90,14 +90,11 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Node Hardware Detection
|
# Network and Cluster Configuration
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
if [ "${SKIP_HARDWARE}" = false ]; then
|
# Configure network settings
|
||||||
print_header "Node Hardware Detection"
|
if [ -z "$(get_current_config "cloud.router.ip")" ]; then
|
||||||
|
|
||||||
# Configure network settings
|
|
||||||
if [ -z "$(get_current_config "cloud.router.ip")" ]; then
|
|
||||||
print_header "Network Configuration"
|
print_header "Network Configuration"
|
||||||
|
|
||||||
CURRENT_IP=$(ip route get 8.8.8.8 | awk '{print $7; exit}' 2>/dev/null || echo "192.168.1.100")
|
CURRENT_IP=$(ip route get 8.8.8.8 | awk '{print $7; exit}' 2>/dev/null || echo "192.168.1.100")
|
||||||
@@ -112,59 +109,62 @@ if [ "${SKIP_HARDWARE}" = false ]; then
|
|||||||
|
|
||||||
print_success "Network configuration completed"
|
print_success "Network configuration completed"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure cluster settings
|
# Configure cluster settings
|
||||||
print_header "Kubernetes Cluster Configuration"
|
print_header "Kubernetes Cluster Configuration"
|
||||||
|
|
||||||
CURRENT_IP=$(ip route get 8.8.8.8 | awk '{print $7; exit}' 2>/dev/null || echo "192.168.1.100")
|
CURRENT_IP=$(ip route get 8.8.8.8 | awk '{print $7; exit}' 2>/dev/null || echo "192.168.1.100")
|
||||||
SUBNET_PREFIX=$(echo "${CURRENT_IP}" | cut -d. -f1-3)
|
SUBNET_PREFIX=$(echo "${CURRENT_IP}" | cut -d. -f1-3)
|
||||||
|
|
||||||
# Talos version
|
# 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.10.4"
|
||||||
talos_version=$(wild-config "cluster.nodes.talos.version")
|
talos_version=$(wild-config "cluster.nodes.talos.version")
|
||||||
|
|
||||||
# MetalLB IP address pool
|
# MetalLB IP address pool
|
||||||
prompt_if_unset_config "cluster.ipAddressPool" "MetalLB IP address pool" "${SUBNET_PREFIX}.80-${SUBNET_PREFIX}.89"
|
prompt_if_unset_config "cluster.ipAddressPool" "MetalLB IP address pool" "${SUBNET_PREFIX}.80-${SUBNET_PREFIX}.89"
|
||||||
ip_pool=$(wild-config "cluster.ipAddressPool")
|
ip_pool=$(wild-config "cluster.ipAddressPool")
|
||||||
|
|
||||||
# Load balancer IP (automatically set to first address in the pool if not set)
|
# Load balancer IP (automatically set to first address in the pool if not set)
|
||||||
current_lb_ip=$(get_current_config "cluster.loadBalancerIp")
|
current_lb_ip=$(get_current_config "cluster.loadBalancerIp")
|
||||||
if [ -z "$current_lb_ip" ] || [ "$current_lb_ip" = "null" ]; then
|
if [ -z "$current_lb_ip" ] || [ "$current_lb_ip" = "null" ]; then
|
||||||
lb_ip=$(echo "${ip_pool}" | cut -d'-' -f1)
|
lb_ip=$(echo "${ip_pool}" | cut -d'-' -f1)
|
||||||
wild-config-set "cluster.loadBalancerIp" "${lb_ip}"
|
wild-config-set "cluster.loadBalancerIp" "${lb_ip}"
|
||||||
print_info "Set load balancer IP to: ${lb_ip} (first IP in MetalLB pool)"
|
print_info "Set load balancer IP to: ${lb_ip} (first IP in MetalLB pool)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Talos schematic ID
|
# Talos schematic ID
|
||||||
current_schematic_id=$(get_current_config "cluster.nodes.talos.schematicId")
|
current_schematic_id=$(get_current_config "cluster.nodes.talos.schematicId")
|
||||||
if [ -z "$current_schematic_id" ] || [ "$current_schematic_id" = "null" ]; then
|
if [ -z "$current_schematic_id" ] || [ "$current_schematic_id" = "null" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
print_info "Get your Talos schematic ID from: https://factory.talos.dev/"
|
print_info "Get your Talos schematic ID from: https://factory.talos.dev/"
|
||||||
print_info "This customizes Talos with the drivers needed for your hardware."
|
print_info "This customizes Talos with the drivers needed for your hardware."
|
||||||
|
|
||||||
# Look up default schematic ID from talos-schemas.yaml
|
# Use current schematic ID from config as default
|
||||||
default_schematic_id=""
|
default_schematic_id=$(get_current_config "cluster.nodes.talos.schematicId")
|
||||||
schemas_file="${WC_ROOT}/setup/cluster-nodes/talos-schemas.yaml"
|
|
||||||
if [ -f "$schemas_file" ]; then
|
|
||||||
default_schematic_id=$(yq eval ".talos-schemas.\"${talos_version}\"" "$schemas_file" 2>/dev/null)
|
|
||||||
if [ -n "$default_schematic_id" ] && [ "$default_schematic_id" != "null" ]; then
|
if [ -n "$default_schematic_id" ] && [ "$default_schematic_id" != "null" ]; then
|
||||||
print_info "Default schematic ID available for Talos $talos_version"
|
print_info "Using schematic ID from config for Talos $talos_version"
|
||||||
else
|
else
|
||||||
default_schematic_id=""
|
default_schematic_id=""
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
schematic_id=$(prompt_with_default "Talos schematic ID" "${default_schematic_id}" "${current_schematic_id}")
|
schematic_id=$(prompt_with_default "Talos schematic ID" "${default_schematic_id}" "${current_schematic_id}")
|
||||||
wild-config-set "cluster.nodes.talos.schematicId" "${schematic_id}"
|
wild-config-set "cluster.nodes.talos.schematicId" "${schematic_id}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# External DNS
|
# External DNS
|
||||||
cluster_name=$(get_current_config "cluster.name")
|
cluster_name=$(get_current_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}"
|
||||||
|
|
||||||
print_success "Cluster configuration completed"
|
print_success "Cluster configuration completed"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Node Hardware Detection
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
if [ "${SKIP_HARDWARE}" = false ]; then
|
||||||
|
print_header "Node Hardware Detection"
|
||||||
|
|
||||||
print_info "This phase will help you register Talos nodes by discovering their hardware."
|
print_info "This phase will help you register Talos nodes by discovering their hardware."
|
||||||
print_info "You'll need nodes booted in maintenance mode and accessible via IP."
|
print_info "You'll need nodes booted in maintenance mode and accessible via IP."
|
||||||
@@ -321,6 +321,16 @@ if [ "${SKIP_HARDWARE}" = false ]; then
|
|||||||
wild-config-set "cluster.nodes.active.\"${TARGET_IP}\".disk" "$SELECTED_DISK"
|
wild-config-set "cluster.nodes.active.\"${TARGET_IP}\".disk" "$SELECTED_DISK"
|
||||||
wild-config-set "cluster.nodes.active.\"${TARGET_IP}\".control" "true"
|
wild-config-set "cluster.nodes.active.\"${TARGET_IP}\".control" "true"
|
||||||
|
|
||||||
|
# Copy current Talos version and schematic ID to this node
|
||||||
|
current_talos_version=$(get_current_config "cluster.nodes.talos.version")
|
||||||
|
current_schematic_id=$(get_current_config "cluster.nodes.talos.schematicId")
|
||||||
|
if [ -n "$current_talos_version" ] && [ "$current_talos_version" != "null" ]; then
|
||||||
|
wild-config-set "cluster.nodes.active.\"${TARGET_IP}\".version" "$current_talos_version"
|
||||||
|
fi
|
||||||
|
if [ -n "$current_schematic_id" ] && [ "$current_schematic_id" != "null" ]; then
|
||||||
|
wild-config-set "cluster.nodes.active.\"${TARGET_IP}\".schematicId" "$current_schematic_id"
|
||||||
|
fi
|
||||||
|
|
||||||
print_success "Node $TARGET_IP registered successfully"
|
print_success "Node $TARGET_IP registered successfully"
|
||||||
|
|
||||||
# Generate machine config.
|
# Generate machine config.
|
||||||
@@ -417,6 +427,16 @@ if [ "${SKIP_HARDWARE}" = false ]; then
|
|||||||
wild-config-set "cluster.nodes.active.\"${WORKER_IP}\".disk" "$SELECTED_DISK"
|
wild-config-set "cluster.nodes.active.\"${WORKER_IP}\".disk" "$SELECTED_DISK"
|
||||||
wild-config-set "cluster.nodes.active.\"${WORKER_IP}\".control" "false"
|
wild-config-set "cluster.nodes.active.\"${WORKER_IP}\".control" "false"
|
||||||
|
|
||||||
|
# Copy current Talos version and schematic ID to this node
|
||||||
|
current_talos_version=$(get_current_config "cluster.nodes.talos.version")
|
||||||
|
current_schematic_id=$(get_current_config "cluster.nodes.talos.schematicId")
|
||||||
|
if [ -n "$current_talos_version" ] && [ "$current_talos_version" != "null" ]; then
|
||||||
|
wild-config-set "cluster.nodes.active.\"${WORKER_IP}\".version" "$current_talos_version"
|
||||||
|
fi
|
||||||
|
if [ -n "$current_schematic_id" ] && [ "$current_schematic_id" != "null" ]; then
|
||||||
|
wild-config-set "cluster.nodes.active.\"${WORKER_IP}\".schematicId" "$current_schematic_id"
|
||||||
|
fi
|
||||||
|
|
||||||
print_success "Worker node $WORKER_IP registered successfully:"
|
print_success "Worker node $WORKER_IP registered successfully:"
|
||||||
print_info " - IP: $WORKER_IP"
|
print_info " - IP: $WORKER_IP"
|
||||||
print_info " - Interface: $INTERFACE"
|
print_info " - Interface: $INTERFACE"
|
||||||
|
@@ -145,43 +145,26 @@ fi
|
|||||||
# BASIC CONFIGURATION
|
# BASIC CONFIGURATION
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# Configure basic settings
|
# Basic Information
|
||||||
if [ ! -f "${WC_HOME}/config.yaml" ] || [ -z "$(get_current_config "operator.email")" ]; then
|
prompt_if_unset_config "operator.email" "Your email address (for Let's Encrypt certificates)" ""
|
||||||
print_header "Basic Configuration"
|
|
||||||
|
|
||||||
# Detect current network for suggestions
|
# Domain Configuration
|
||||||
CURRENT_IP=$(ip route get 8.8.8.8 | awk '{print $7; exit}' 2>/dev/null || echo "192.168.1.100")
|
prompt_if_unset_config "cloud.baseDomain" "Your base domain name (e.g., example.com)" ""
|
||||||
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)
|
|
||||||
print_info "Detected network: ${SUBNET_PREFIX}.x (gateway: ${GATEWAY_IP})"
|
|
||||||
|
|
||||||
echo "This will configure basic settings for your wild-cloud deployment."
|
# Get base domain to use as default for cloud domain
|
||||||
echo ""
|
base_domain=$(wild-config "cloud.baseDomain")
|
||||||
|
prompt_if_unset_config "cloud.domain" "Your public cloud domain" "cloud.${base_domain}"
|
||||||
|
|
||||||
# Basic Information
|
# Get cloud domain to use as default for internal domain
|
||||||
prompt_if_unset_config "operator.email" "Your email address (for Let's Encrypt certificates)" ""
|
domain=$(wild-config "cloud.domain")
|
||||||
|
prompt_if_unset_config "cloud.internalDomain" "Your internal cloud domain" "internal.${domain}"
|
||||||
|
|
||||||
# Domain Configuration
|
# Derive cluster name from domain if not already set
|
||||||
prompt_if_unset_config "cloud.baseDomain" "Your base domain name (e.g., example.com)" ""
|
current_cluster_name=$(get_current_config "cluster.name")
|
||||||
|
if [ -z "$current_cluster_name" ] || [ "$current_cluster_name" = "null" ]; then
|
||||||
# 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}"
|
|
||||||
|
|
||||||
# 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 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:]')
|
cluster_name=$(echo "${domain}" | tr '.' '-' | tr '[:upper:]' '[:lower:]')
|
||||||
wild-config-set "cluster.name" "${cluster_name}"
|
wild-config-set "cluster.name" "${cluster_name}"
|
||||||
print_info "Set cluster name to: ${cluster_name}"
|
print_info "Set cluster name to: ${cluster_name}"
|
||||||
fi
|
|
||||||
|
|
||||||
print_success "Basic configuration completed"
|
|
||||||
echo ""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
@@ -1,140 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Talos ISO download script
|
|
||||||
# Downloads custom Talos ISO with system extensions for USB boot
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
ISO_DIR="${WC_HOME}/.wildcloud/iso"
|
|
||||||
FORCE_DOWNLOAD=false
|
|
||||||
|
|
||||||
# Parse arguments
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case $1 in
|
|
||||||
--force)
|
|
||||||
FORCE_DOWNLOAD=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-h|--help)
|
|
||||||
echo "Usage: wild-talos-iso [--force]"
|
|
||||||
echo ""
|
|
||||||
echo "Downloads custom Talos ISO with system extensions for USB boot."
|
|
||||||
echo ""
|
|
||||||
echo "Options:"
|
|
||||||
echo " --force Force re-download even if ISO already exists"
|
|
||||||
echo " -h, --help Show this help message"
|
|
||||||
echo ""
|
|
||||||
echo "This script:"
|
|
||||||
echo " 1. Gets schematic ID and Talos version from config.yaml"
|
|
||||||
echo " 2. Downloads custom ISO from Talos Image Factory"
|
|
||||||
echo " 3. Saves ISO to .wildcloud/iso/ directory"
|
|
||||||
echo ""
|
|
||||||
echo "The ISO includes extensions configured in config.yaml:"
|
|
||||||
echo " (.cluster.nodes.talos.schematic.customization.systemExtensions)"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown option: $1"
|
|
||||||
echo "Use --help for usage information"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Downloading custom Talos ISO with system extensions..."
|
|
||||||
|
|
||||||
# Get Talos version and schematic ID from config
|
|
||||||
TALOS_VERSION=$(yq eval '.cluster.nodes.talos.version' "$CONFIG_FILE")
|
|
||||||
SCHEMATIC_ID=$(yq eval '.cluster.nodes.talos.schematicId // ""' "$CONFIG_FILE")
|
|
||||||
|
|
||||||
if [ -z "$TALOS_VERSION" ] || [ "$TALOS_VERSION" = "null" ]; then
|
|
||||||
echo "Error: No Talos version found in config.yaml at .cluster.nodes.talos.version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$SCHEMATIC_ID" ] || [ "$SCHEMATIC_ID" = "null" ]; then
|
|
||||||
echo "Error: No schematic ID found in config.yaml"
|
|
||||||
echo "Run 'wild-talos-schema' first to upload schematic and get ID"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Talos version: $TALOS_VERSION"
|
|
||||||
echo "Schematic ID: $SCHEMATIC_ID"
|
|
||||||
echo ""
|
|
||||||
echo "ISO includes extensions:"
|
|
||||||
yq eval '.cluster.nodes.talos.schematic.customization.systemExtensions.officialExtensions[]' "$CONFIG_FILE" | sed 's/^/ - /'
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Create ISO directory
|
|
||||||
mkdir -p "$ISO_DIR"
|
|
||||||
|
|
||||||
# Define ISO filename and path
|
|
||||||
ISO_FILENAME="talos-${TALOS_VERSION}-metal-amd64.iso"
|
|
||||||
ISO_PATH="${ISO_DIR}/${ISO_FILENAME}"
|
|
||||||
|
|
||||||
# Check if ISO already exists
|
|
||||||
if [ -f "$ISO_PATH" ] && [ "$FORCE_DOWNLOAD" = false ]; then
|
|
||||||
echo "✅ ISO already exists: $ISO_PATH"
|
|
||||||
echo "Use --force to re-download"
|
|
||||||
echo ""
|
|
||||||
echo "To create a bootable USB:"
|
|
||||||
echo " See docs/node_setup.md for USB creation instructions"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download ISO from Image Factory
|
|
||||||
ISO_URL="https://factory.talos.dev/image/${SCHEMATIC_ID}/${TALOS_VERSION}/metal-amd64.iso"
|
|
||||||
echo "Downloading ISO from: $ISO_URL"
|
|
||||||
echo "Saving to: $ISO_PATH"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Download with progress bar
|
|
||||||
if command -v wget >/dev/null 2>&1; then
|
|
||||||
wget --progress=bar:force -O "$ISO_PATH" "$ISO_URL"
|
|
||||||
elif command -v curl >/dev/null 2>&1; then
|
|
||||||
curl -L --progress-bar -o "$ISO_PATH" "$ISO_URL"
|
|
||||||
else
|
|
||||||
echo "Error: Neither wget nor curl is available for downloading"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Verify download
|
|
||||||
if [ ! -f "$ISO_PATH" ] || [ ! -s "$ISO_PATH" ]; then
|
|
||||||
echo "Error: Download failed or file is empty"
|
|
||||||
rm -f "$ISO_PATH"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get file size for verification
|
|
||||||
FILE_SIZE=$(du -h "$ISO_PATH" | cut -f1)
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "✅ Custom Talos ISO downloaded successfully!"
|
|
||||||
echo ""
|
|
||||||
echo "ISO Details:"
|
|
||||||
echo " File: $ISO_PATH"
|
|
||||||
echo " Size: $FILE_SIZE"
|
|
||||||
echo " Version: $TALOS_VERSION"
|
|
||||||
echo " Extensions: $(yq eval '.cluster.nodes.talos.schematic.customization.systemExtensions.officialExtensions | length' "$CONFIG_FILE") extensions included"
|
|
||||||
echo " Auto-wipe: Enabled (will wipe existing Talos installations)"
|
|
||||||
echo ""
|
|
||||||
echo "Next steps:"
|
|
||||||
echo "1. Create bootable USB drive (see docs/node_setup.md)"
|
|
||||||
echo "2. Boot target machine from USB"
|
|
||||||
echo "3. Run hardware detection: ./detect-node-hardware.sh <maintenance-ip> <node-number>"
|
|
||||||
echo "4. Apply machine configuration"
|
|
||||||
echo ""
|
|
||||||
echo "USB Creation Quick Reference:"
|
|
||||||
echo " Linux: sudo dd if=$ISO_PATH of=/dev/sdX bs=4M status=progress"
|
|
||||||
echo " macOS: sudo dd if=$ISO_PATH of=/dev/rdiskX bs=4m"
|
|
||||||
echo " Windows: Use Rufus, Balena Etcher, or similar tool"
|
|
@@ -12,8 +12,12 @@
|
|||||||
# 3. Generate the schematic
|
# 3. Generate the schematic
|
||||||
# 4. Add the version and schematic ID below
|
# 4. Add the version and schematic ID below
|
||||||
|
|
||||||
# Format: "version": "schematic-id"
|
# Format: Each schematic ID is the primary key with version and definition nested
|
||||||
schematic:
|
"434a0300db532066f1098e05ac068159371d00f0aba0a3103a0e826e83825c82":
|
||||||
|
version: "v1.10.5"
|
||||||
|
architecture: "amd64"
|
||||||
|
secureBoot: false
|
||||||
|
schematic:
|
||||||
customization:
|
customization:
|
||||||
extraKernelArgs:
|
extraKernelArgs:
|
||||||
- -talos.halt_if_installed
|
- -talos.halt_if_installed
|
||||||
@@ -23,7 +27,21 @@ schematic:
|
|||||||
- siderolabs/intel-ucode
|
- siderolabs/intel-ucode
|
||||||
- siderolabs/iscsi-tools
|
- siderolabs/iscsi-tools
|
||||||
- siderolabs/util-linux-tools
|
- siderolabs/util-linux-tools
|
||||||
|
"f309e674d9ad94655e2cf8a43ea1432475c717cd1885f596bd7ec852b900bc5b":
|
||||||
talos-schemas:
|
version: "v1.10.4"
|
||||||
"v1.10.3": "e6230b0db3fd355a0bb77a9de74af41a9f3edd168f913cbd94807629a2116d07"
|
architecture: "amd64"
|
||||||
"v1.10.4": "434a0300db532066f1098e05ac068159371d00f0aba0a3103a0e826e83825c82"
|
secureBoot: true
|
||||||
|
schematic:
|
||||||
|
customization:
|
||||||
|
systemExtensions:
|
||||||
|
officialExtensions:
|
||||||
|
- siderolabs/gvisor
|
||||||
|
- siderolabs/intel-ucode
|
||||||
|
- siderolabs/iscsi-tools
|
||||||
|
- siderolabs/nvidia-container-toolkit-lts
|
||||||
|
- siderolabs/nvidia-container-toolkit-production
|
||||||
|
- siderolabs/nvidia-fabricmanager-lts
|
||||||
|
- siderolabs/nvidia-fabricmanager-production
|
||||||
|
- siderolabs/nvidia-open-gpu-kernel-modules-lts
|
||||||
|
- siderolabs/nvidia-open-gpu-kernel-modules-production
|
||||||
|
- siderolabs/util-linux-tools"
|
||||||
|
Reference in New Issue
Block a user