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>
66 lines
1.9 KiB
Bash
Executable File
66 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# test-boot.sh — Automated boot test: verify KubeSolo OS boots in QEMU
|
|
# Usage: ./test/qemu/test-boot.sh <iso-path>
|
|
# Exit 0 = PASS, Exit 1 = FAIL
|
|
set -euo pipefail
|
|
|
|
ISO="${1:?Usage: $0 <path-to-iso>}"
|
|
TIMEOUT_BOOT=120 # seconds to wait for boot success marker
|
|
SERIAL_LOG=$(mktemp /tmp/kubesolo-boot-test-XXXXXX.log)
|
|
|
|
# Temp data disk
|
|
DATA_DISK=$(mktemp /tmp/kubesolo-data-XXXXXX.img)
|
|
dd if=/dev/zero of="$DATA_DISK" bs=1M count=512 2>/dev/null
|
|
mkfs.ext4 -q -L KSOLODATA "$DATA_DISK" 2>/dev/null
|
|
|
|
cleanup() {
|
|
kill "$QEMU_PID" 2>/dev/null || true
|
|
rm -f "$DATA_DISK" "$SERIAL_LOG"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
echo "==> Boot test: $ISO"
|
|
echo " Timeout: ${TIMEOUT_BOOT}s"
|
|
echo " Serial log: $SERIAL_LOG"
|
|
|
|
# Launch QEMU in background
|
|
qemu-system-x86_64 \
|
|
-m 2048 -smp 2 \
|
|
-nographic \
|
|
-cdrom "$ISO" \
|
|
-boot d \
|
|
-drive "file=$DATA_DISK,format=raw,if=virtio" \
|
|
-net nic,model=virtio \
|
|
-net user \
|
|
-serial file:"$SERIAL_LOG" \
|
|
-append "console=ttyS0,115200n8 kubesolo.data=/dev/vda kubesolo.debug" \
|
|
&
|
|
QEMU_PID=$!
|
|
|
|
# Wait for boot success marker in serial log
|
|
echo " Waiting for boot..."
|
|
ELAPSED=0
|
|
while [ "$ELAPSED" -lt "$TIMEOUT_BOOT" ]; do
|
|
if grep -q "\[kubesolo-init\] \[OK\] Stage 90-kubesolo.sh complete" "$SERIAL_LOG" 2>/dev/null; then
|
|
echo ""
|
|
echo "==> PASS: KubeSolo OS booted successfully in ${ELAPSED}s"
|
|
exit 0
|
|
fi
|
|
if ! kill -0 "$QEMU_PID" 2>/dev/null; then
|
|
echo ""
|
|
echo "==> FAIL: QEMU exited prematurely"
|
|
echo " Last 20 lines of serial log:"
|
|
tail -20 "$SERIAL_LOG" 2>/dev/null
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
ELAPSED=$((ELAPSED + 1))
|
|
printf "\r Elapsed: %ds / %ds" "$ELAPSED" "$TIMEOUT_BOOT"
|
|
done
|
|
|
|
echo ""
|
|
echo "==> FAIL: Boot did not complete within ${TIMEOUT_BOOT}s"
|
|
echo " Last 30 lines of serial log:"
|
|
tail -30 "$SERIAL_LOG" 2>/dev/null
|
|
exit 1
|