Complete Phase 1 implementation of KubeSolo OS — an immutable, bootable Linux distribution built on Tiny Core Linux for running KubeSolo single-node Kubernetes. Build system: - Makefile with fetch, rootfs, initramfs, iso, disk-image targets - Dockerfile.builder for reproducible builds - Scripts to download Tiny Core, extract rootfs, inject KubeSolo, pack initramfs, and create bootable ISO/disk images Init system (10 POSIX sh stages): - Early mount (proc/sys/dev/cgroup2), cmdline parsing, persistent mount with bind-mounts, kernel module loading, sysctl, DHCP networking, hostname, clock sync, containerd prep, KubeSolo exec Shared libraries: - functions.sh (device wait, IP lookup, config helpers) - network.sh (static IP, config persistence, interface detection) - health.sh (containerd, API server, node readiness checks) - Emergency shell for boot failure debugging Testing: - QEMU boot test with serial log marker detection - K8s readiness test with kubectl verification - Persistence test (reboot + verify state survives) - Workload deployment test (nginx pod) - Local storage test (PVC + local-path provisioner) - Network policy test - Reusable run-vm.sh launcher Developer tools: - dev-vm.sh (interactive QEMU with port forwarding) - rebuild-initramfs.sh (fast iteration) - inject-ssh.sh (dropbear SSH for debugging) - extract-kernel-config.sh + kernel-audit.sh Documentation: - Full design document with architecture research - Boot flow documentation covering all 10 init stages - Cloud-init examples (DHCP, static IP, Portainer Edge, air-gapped) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
73 lines
2.6 KiB
Bash
Executable File
73 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# fetch-components.sh — Download Tiny Core ISO and KubeSolo binary
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
CACHE_DIR="${CACHE_DIR:-$PROJECT_ROOT/build/cache}"
|
|
|
|
# Load versions
|
|
# shellcheck source=../config/versions.env
|
|
. "$SCRIPT_DIR/../config/versions.env"
|
|
|
|
mkdir -p "$CACHE_DIR"
|
|
|
|
# --- Tiny Core Linux ISO ---
|
|
TC_ISO="$CACHE_DIR/$TINYCORE_ISO"
|
|
TC_URL="${TINYCORE_MIRROR}/${TINYCORE_VERSION%%.*}.x/${TINYCORE_ARCH}/release/${TINYCORE_ISO}"
|
|
|
|
if [ -f "$TC_ISO" ]; then
|
|
echo "==> Tiny Core ISO already cached: $TC_ISO"
|
|
else
|
|
echo "==> Downloading Tiny Core Linux ${TINYCORE_VERSION} (${TINYCORE_ARCH})..."
|
|
echo " URL: $TC_URL"
|
|
wget -q --show-progress -O "$TC_ISO" "$TC_URL" || {
|
|
# Fallback: try alternate mirror structure
|
|
TC_URL_ALT="${TINYCORE_MIRROR}/${TINYCORE_VERSION%%.*}.x/${TINYCORE_ARCH}/release/CorePure64-current.iso"
|
|
echo " Primary URL failed, trying: $TC_URL_ALT"
|
|
wget -q --show-progress -O "$TC_ISO" "$TC_URL_ALT"
|
|
}
|
|
echo "==> Downloaded: $TC_ISO ($(du -h "$TC_ISO" | cut -f1))"
|
|
fi
|
|
|
|
# --- KubeSolo ---
|
|
KUBESOLO_INSTALLER="$CACHE_DIR/install-kubesolo.sh"
|
|
KUBESOLO_BIN="$CACHE_DIR/kubesolo"
|
|
|
|
if [ -f "$KUBESOLO_BIN" ]; then
|
|
echo "==> KubeSolo binary already cached: $KUBESOLO_BIN"
|
|
else
|
|
echo "==> Downloading KubeSolo installer..."
|
|
curl -sfL "$KUBESOLO_INSTALL_URL" -o "$KUBESOLO_INSTALLER"
|
|
|
|
echo "==> Extracting KubeSolo binary..."
|
|
echo " NOTE: The installer normally runs 'install'. We extract the binary URL instead."
|
|
echo " For Phase 1 PoC, install KubeSolo on a host and copy the binary."
|
|
echo ""
|
|
echo " Manual step required:"
|
|
echo " 1. On a Linux x86_64 host: curl -sfL https://get.kubesolo.io | sudo sh -"
|
|
echo " 2. Copy /usr/local/bin/kubesolo to: $KUBESOLO_BIN"
|
|
echo " 3. Re-run: make rootfs"
|
|
echo ""
|
|
|
|
# Try to extract download URL from installer script
|
|
BINARY_URL=$(grep -oP 'https://[^ ]+kubesolo[^ ]+' "$KUBESOLO_INSTALLER" 2>/dev/null | head -1 || true)
|
|
if [ -n "$BINARY_URL" ]; then
|
|
echo " Attempting direct download from: $BINARY_URL"
|
|
curl -sfL "$BINARY_URL" -o "$KUBESOLO_BIN" && chmod +x "$KUBESOLO_BIN" || {
|
|
echo " Direct download failed. Use manual step above."
|
|
}
|
|
fi
|
|
|
|
if [ -f "$KUBESOLO_BIN" ]; then
|
|
echo "==> KubeSolo binary: $KUBESOLO_BIN ($(du -h "$KUBESOLO_BIN" | cut -f1))"
|
|
fi
|
|
fi
|
|
|
|
# --- Summary ---
|
|
echo ""
|
|
echo "==> Component cache:"
|
|
ls -lh "$CACHE_DIR"/ 2>/dev/null || true
|
|
echo ""
|
|
echo "==> Fetch complete."
|