Breaks out wild-setup phases into independently-runnable scripts.
Remove deprecated scripts and add Talos schema mappings - Deleted the following scripts as they are no longer needed: - create-installer-image.sh - detect-node-hardware.sh - generate-machine-configs.sh - Added a new file `talos-schemas.yaml` to maintain mappings of Talos versions to their corresponding schematic IDs for wild-cloud deployments. - Updated the README in the home scaffold to simplify the initial setup instructions.
This commit is contained in:
@@ -44,52 +44,66 @@ fi
|
||||
|
||||
# Create setup bundle.
|
||||
|
||||
# Copy iPXE bootloader to ipxe-web.
|
||||
echo "Copying Talos kernel and initramfs for PXE boot..."
|
||||
# Copy iPXE bootloader to ipxe-web from cached assets.
|
||||
echo "Copying Talos PXE assets from cache..."
|
||||
PXE_WEB_ROOT="${BUNDLE_DIR}/ipxe-web"
|
||||
mkdir -p "${PXE_WEB_ROOT}/amd64"
|
||||
cp "${DNSMASQ_SETUP_DIR}/boot.ipxe" "${PXE_WEB_ROOT}/boot.ipxe"
|
||||
|
||||
# Get Talos schematic ID from centralized config.
|
||||
# The schematic should be uploaded via wild-talos-schema first.
|
||||
echo "Getting Talos schematic ID from config..."
|
||||
TALOS_ID=$(wild-config cluster.nodes.talos.schematicId)
|
||||
if [ -z "${TALOS_ID}" ] || [ "${TALOS_ID}" = "null" ]; then
|
||||
echo "Error: No schematic ID found in config.yaml"
|
||||
echo "Run 'wild-talos-schema' first to upload schematic and get ID"
|
||||
# Define cache directories
|
||||
CACHE_DIR="${WC_HOME}/.wildcloud"
|
||||
PXE_CACHE_DIR="${CACHE_DIR}/pxe"
|
||||
IPXE_CACHE_DIR="${CACHE_DIR}/ipxe"
|
||||
|
||||
# Check if cached assets exist
|
||||
KERNEL_CACHE_PATH="${PXE_CACHE_DIR}/amd64/vmlinuz"
|
||||
INITRAMFS_CACHE_PATH="${PXE_CACHE_DIR}/amd64/initramfs.xz"
|
||||
|
||||
if [ ! -f "${KERNEL_CACHE_PATH}" ] || [ ! -f "${INITRAMFS_CACHE_PATH}" ]; then
|
||||
echo "Error: Talos PXE assets not found in cache"
|
||||
echo "Expected locations:"
|
||||
echo " Kernel: ${KERNEL_CACHE_PATH}"
|
||||
echo " Initramfs: ${INITRAMFS_CACHE_PATH}"
|
||||
echo ""
|
||||
echo "Please run 'wild-cluster-node-image-create' first to download and cache the assets."
|
||||
exit 1
|
||||
fi
|
||||
echo "Using Talos schematic ID: ${TALOS_ID}"
|
||||
|
||||
# Verify schematic includes expected extensions
|
||||
echo "Schematic includes:"
|
||||
yq eval '.cluster.nodes.talos.schematic.customization.systemExtensions.officialExtensions[]' ./config.yaml | sed 's/^/ - /'
|
||||
# Copy Talos PXE assets from cache
|
||||
echo "Copying Talos kernel from cache..."
|
||||
cp "${KERNEL_CACHE_PATH}" "${PXE_WEB_ROOT}/amd64/vmlinuz"
|
||||
echo "✅ Talos kernel copied from cache"
|
||||
|
||||
# Download kernel to ipxe-web if it's not already there.
|
||||
TALOS_VERSION=$(wild-config cluster.nodes.talos.version) || exit 1
|
||||
if [ ! -f "${PXE_WEB_ROOT}/amd64/vmlinuz" ]; then
|
||||
echo "Downloading Talos kernel..."
|
||||
wget -O "${PXE_WEB_ROOT}/amd64/vmlinuz" "https://pxe.factory.talos.dev/image/${TALOS_ID}/${TALOS_VERSION}/kernel-amd64"
|
||||
else
|
||||
echo "Talos kernel already exists, skipping download"
|
||||
fi
|
||||
echo "Copying Talos initramfs from cache..."
|
||||
cp "${INITRAMFS_CACHE_PATH}" "${PXE_WEB_ROOT}/amd64/initramfs.xz"
|
||||
echo "✅ Talos initramfs copied from cache"
|
||||
|
||||
# Download initramfs to ipxe-web if it's not already there.
|
||||
if [ ! -f "${PXE_WEB_ROOT}/amd64/initramfs.xz" ]; then
|
||||
echo "Downloading Talos initramfs..."
|
||||
wget -O "${PXE_WEB_ROOT}/amd64/initramfs.xz" "https://pxe.factory.talos.dev/image/${TALOS_ID}/${TALOS_VERSION}/initramfs-amd64.xz"
|
||||
else
|
||||
echo "Talos initramfs already exists, skipping download"
|
||||
fi
|
||||
|
||||
# Update PXE's iPXE bootloader files.
|
||||
# TODO: Put download to cache first.
|
||||
echo "Updating iPXE ftpd bootloader files."
|
||||
# Copy iPXE bootloader files from cache
|
||||
echo "Copying iPXE bootloader files from cache..."
|
||||
FTPD_DIR="${BUNDLE_DIR}/pxe-ftpd"
|
||||
mkdir -p $FTPD_DIR
|
||||
wget http://boot.ipxe.org/ipxe.efi -O ${FTPD_DIR}/ipxe.efi
|
||||
wget http://boot.ipxe.org/undionly.kpxe -O ${FTPD_DIR}/undionly.kpxe
|
||||
wget http://boot.ipxe.org/arm64-efi/ipxe.efi -O ${FTPD_DIR}/ipxe-arm64.efi
|
||||
mkdir -p "${FTPD_DIR}"
|
||||
|
||||
# Check if iPXE assets exist in cache
|
||||
IPXE_EFI_CACHE="${IPXE_CACHE_DIR}/ipxe.efi"
|
||||
IPXE_BIOS_CACHE="${IPXE_CACHE_DIR}/undionly.kpxe"
|
||||
IPXE_ARM64_CACHE="${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
||||
|
||||
if [ ! -f "${IPXE_EFI_CACHE}" ] || [ ! -f "${IPXE_BIOS_CACHE}" ] || [ ! -f "${IPXE_ARM64_CACHE}" ]; then
|
||||
echo "Error: iPXE bootloader assets not found in cache"
|
||||
echo "Expected locations:"
|
||||
echo " iPXE EFI: ${IPXE_EFI_CACHE}"
|
||||
echo " iPXE BIOS: ${IPXE_BIOS_CACHE}"
|
||||
echo " iPXE ARM64: ${IPXE_ARM64_CACHE}"
|
||||
echo ""
|
||||
echo "Please run 'wild-cluster-node-image-create' first to download and cache the assets."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy iPXE assets from cache
|
||||
cp "${IPXE_EFI_CACHE}" "${FTPD_DIR}/ipxe.efi"
|
||||
cp "${IPXE_BIOS_CACHE}" "${FTPD_DIR}/undionly.kpxe"
|
||||
cp "${IPXE_ARM64_CACHE}" "${FTPD_DIR}/ipxe-arm64.efi"
|
||||
echo "✅ iPXE bootloader files copied from cache"
|
||||
|
||||
|
||||
cp "${DNSMASQ_SETUP_DIR}/nginx.conf" "${BUNDLE_DIR}/nginx.conf"
|
||||
|
Reference in New Issue
Block a user