Full cloud setup test run #1 fixes.
This commit is contained in:
@@ -51,76 +51,32 @@ else
|
||||
init_wild_env
|
||||
fi
|
||||
|
||||
# Check for required configuration
|
||||
if [ -z "$(wild-config "cluster.nodes.talos.version")" ] || [ -z "$(wild-config "cluster.nodes.talos.schematicId")" ]; then
|
||||
print_header "Talos Configuration Required"
|
||||
print_error "Missing required Talos configuration"
|
||||
print_info "Please run 'wild-setup' first to configure your cluster"
|
||||
print_info "Or set the required configuration manually:"
|
||||
print_info " wild-config-set cluster.nodes.talos.version v1.10.4"
|
||||
print_info " wild-config-set cluster.nodes.talos.schematicId YOUR_SCHEMATIC_ID"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# INSTALLER IMAGE GENERATION AND ASSET DOWNLOADING
|
||||
# =============================================================================
|
||||
|
||||
print_header "Talos Installer Image Generation and Asset Download"
|
||||
print_header "Talos asset download"
|
||||
|
||||
# Get Talos version and schematic ID from config
|
||||
TALOS_VERSION=$(wild-config cluster.nodes.talos.version)
|
||||
SCHEMATIC_ID=$(wild-config cluster.nodes.talos.schematicId)
|
||||
# Talos version
|
||||
prompt_if_unset_config "cluster.nodes.talos.version" "Talos version" "v1.11.0"
|
||||
TALOS_VERSION=$(wild-config "cluster.nodes.talos.version")
|
||||
|
||||
# Talos schematic ID
|
||||
prompt_if_unset_config "cluster.nodes.talos.schematicId" "Talos schematic ID" "56774e0894c8a3a3a9834a2aea65f24163cacf9506abbcbdc3ba135eaca4953f"
|
||||
SCHEMATIC_ID=$(wild-config "cluster.nodes.talos.schematicId")
|
||||
|
||||
print_info "Creating custom Talos installer image..."
|
||||
print_info "Talos version: $TALOS_VERSION"
|
||||
|
||||
# Validate schematic ID
|
||||
if [ -z "$SCHEMATIC_ID" ] || [ "$SCHEMATIC_ID" = "null" ]; then
|
||||
print_error "No schematic ID found in config.yaml"
|
||||
print_info "Please run 'wild-setup' first to configure your cluster"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_info "Schematic ID: $SCHEMATIC_ID"
|
||||
|
||||
if [ -f "${WC_HOME}/config.yaml" ] && yq eval '.cluster.nodes.talos.schematic.customization.systemExtensions.officialExtensions' "${WC_HOME}/config.yaml" >/dev/null 2>&1; then
|
||||
echo ""
|
||||
print_info "Schematic includes:"
|
||||
yq eval '.cluster.nodes.talos.schematic.customization.systemExtensions.officialExtensions[]' "${WC_HOME}/config.yaml" | sed 's/^/ - /' || true
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Generate installer image URL
|
||||
INSTALLER_URL="factory.talos.dev/metal-installer/$SCHEMATIC_ID:$TALOS_VERSION"
|
||||
|
||||
print_success "Custom installer image URL generated!"
|
||||
echo ""
|
||||
print_info "Installer URL: $INSTALLER_URL"
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# ASSET DOWNLOADING AND CACHING
|
||||
# =============================================================================
|
||||
|
||||
print_header "Downloading and Caching PXE Boot Assets"
|
||||
|
||||
# Create cache directories organized by schematic ID
|
||||
CACHE_DIR="${WC_HOME}/.wildcloud"
|
||||
SCHEMATIC_CACHE_DIR="${CACHE_DIR}/node-boot-assets/${SCHEMATIC_ID}"
|
||||
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 "$IPXE_CACHE_DIR"
|
||||
mkdir -p "$ISO_CACHE_DIR"
|
||||
|
||||
# Download Talos kernel and initramfs for PXE boot
|
||||
print_info "Downloading Talos PXE assets..."
|
||||
KERNEL_URL="https://pxe.factory.talos.dev/image/${SCHEMATIC_ID}/${TALOS_VERSION}/kernel-amd64"
|
||||
INITRAMFS_URL="https://pxe.factory.talos.dev/image/${SCHEMATIC_ID}/${TALOS_VERSION}/initramfs-amd64.xz"
|
||||
|
||||
KERNEL_PATH="${PXE_CACHE_DIR}/amd64/vmlinuz"
|
||||
INITRAMFS_PATH="${PXE_CACHE_DIR}/amd64/initramfs.xz"
|
||||
print_header "Downloading and caching boot assets"
|
||||
|
||||
# Function to download with progress
|
||||
download_asset() {
|
||||
@@ -129,17 +85,19 @@ download_asset() {
|
||||
local description="$3"
|
||||
|
||||
if [ -f "$path" ]; then
|
||||
print_info "$description already cached at $path"
|
||||
print_success "$description already cached at $path"
|
||||
return 0
|
||||
fi
|
||||
|
||||
print_info "Downloading $description..."
|
||||
print_info "URL: $url"
|
||||
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
wget --progress=bar:force -O "$path" "$url"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
curl -L --progress-bar -o "$path" "$url"
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -L -o "$path" "$url" \
|
||||
--progress-bar \
|
||||
--write-out "✓ Downloaded %{size_download} bytes at %{speed_download} B/s\n"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget --progress=bar:force:noscroll -O "$path" "$url"
|
||||
else
|
||||
print_error "Neither wget nor curl is available for downloading"
|
||||
return 1
|
||||
@@ -153,42 +111,51 @@ download_asset() {
|
||||
fi
|
||||
|
||||
print_success "$description downloaded successfully"
|
||||
echo
|
||||
}
|
||||
|
||||
# Download Talos PXE assets
|
||||
CACHE_DIR="${WC_HOME}/.wildcloud"
|
||||
SCHEMATIC_CACHE_DIR="${CACHE_DIR}/node-boot-assets/${SCHEMATIC_ID}"
|
||||
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 "$IPXE_CACHE_DIR"
|
||||
mkdir -p "$ISO_CACHE_DIR"
|
||||
|
||||
# Download Talos kernel and initramfs for PXE boot
|
||||
KERNEL_URL="https://pxe.factory.talos.dev/image/${SCHEMATIC_ID}/${TALOS_VERSION}/kernel-amd64"
|
||||
KERNEL_PATH="${PXE_CACHE_DIR}/amd64/vmlinuz"
|
||||
download_asset "$KERNEL_URL" "$KERNEL_PATH" "Talos kernel"
|
||||
|
||||
INITRAMFS_URL="https://pxe.factory.talos.dev/image/${SCHEMATIC_ID}/${TALOS_VERSION}/initramfs-amd64.xz"
|
||||
INITRAMFS_PATH="${PXE_CACHE_DIR}/amd64/initramfs.xz"
|
||||
download_asset "$INITRAMFS_URL" "$INITRAMFS_PATH" "Talos initramfs"
|
||||
|
||||
# Download iPXE bootloader files
|
||||
print_info "Downloading iPXE bootloader assets..."
|
||||
download_asset "http://boot.ipxe.org/ipxe.efi" "${IPXE_CACHE_DIR}/ipxe.efi" "iPXE EFI 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 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}"
|
||||
ISO_PATH="${ISO_CACHE_DIR}/talos-${TALOS_VERSION}-metal-amd64.iso"
|
||||
download_asset "$ISO_URL" "$ISO_PATH" "Talos ISO"
|
||||
|
||||
echo ""
|
||||
print_success "All assets downloaded and cached!"
|
||||
echo ""
|
||||
print_info "Cached assets for schematic $SCHEMATIC_ID:"
|
||||
echo " Talos kernel: $KERNEL_PATH"
|
||||
echo " Talos initramfs: $INITRAMFS_PATH"
|
||||
echo " Talos ISO: $ISO_PATH"
|
||||
echo " iPXE EFI: ${IPXE_CACHE_DIR}/ipxe.efi"
|
||||
echo " iPXE BIOS: ${IPXE_CACHE_DIR}/undionly.kpxe"
|
||||
echo " iPXE ARM64: ${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
||||
print_header "Summary"
|
||||
print_success "Cached assets for schematic $SCHEMATIC_ID:"
|
||||
echo "- Talos kernel: $KERNEL_PATH"
|
||||
echo "- Talos initramfs: $INITRAMFS_PATH"
|
||||
echo "- Talos ISO: $ISO_PATH"
|
||||
echo "- iPXE EFI: ${IPXE_CACHE_DIR}/ipxe.efi"
|
||||
echo "- iPXE BIOS: ${IPXE_CACHE_DIR}/undionly.kpxe"
|
||||
echo "- iPXE ARM64: ${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
||||
echo ""
|
||||
print_info "Cache location: $SCHEMATIC_CACHE_DIR"
|
||||
echo ""
|
||||
print_info "Use these assets for:"
|
||||
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 "- 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 ""
|
||||
print_success "Installer image generation and asset caching completed!"
|
Reference in New Issue
Block a user