feat: multi-distro support and tagged golden snapshots

Add Alpine, Debian, and Ubuntu rootfs support to `init [distro]`.
Golden snapshots are now namespaced under `golden/<tag>/` so multiple
baselines can coexist. `spawn [tag] [N]` selects which snapshot to
clone from. Systemd-based distros (Debian, Ubuntu) get a fc-net-init
systemd unit; Alpine keeps its inittab-based init.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 20:48:43 +00:00
parent bfc1f47287
commit fb1db7c9ea
10 changed files with 576 additions and 102 deletions

View File

@@ -2,6 +2,7 @@ package orchestrator
import (
"os"
"path/filepath"
"strconv"
)
@@ -11,7 +12,7 @@ type Config struct {
BaseDir string // working directory for all state
Kernel string // path to vmlinux
KernelURL string // URL to download vmlinux if Kernel file is missing
Rootfs string // path to base rootfs.ext4
CustomRootfs string // Custom path to rootfs if FC_ROOTFS is set
VCPUs int64
MemMiB int64
Bridge string // host bridge name, or "none" to skip networking
@@ -38,10 +39,18 @@ func DefaultConfig() Config {
c.Kernel = envOr("FC_KERNEL", c.BaseDir+"/vmlinux")
c.KernelURL = envOr("FC_KERNEL_URL",
"https://s3.amazonaws.com/spec.ccfc.min/firecracker-ci/20260408-ce2a467895c1-0/x86_64/vmlinux-6.1.166")
c.Rootfs = envOr("FC_ROOTFS", c.BaseDir+"/rootfs.ext4")
c.CustomRootfs = os.Getenv("FC_ROOTFS")
return c
}
// RootfsPath returns the path to the root filesystem depending on the requested distribution.
func (c Config) RootfsPath(distro string) string {
if c.CustomRootfs != "" {
return c.CustomRootfs
}
return filepath.Join(c.BaseDir, "rootfs-"+distro+".ext4")
}
func envOr(key, fallback string) string {
if v := os.Getenv(key); v != "" {
return v