forked from tangled.org/core
core spindle engines microvm
1 folder · 53 files

placement
agent_test.go
agent.go
args.go
attic_test.go
attic.go
bench-boot.sh
budget_test.go
budget.go
cache.go
cgroup_oom_test.go
cgroup_other.go
cgroup_resources_test.go
cgroup_test.go
cgroup.go
cid_test.go
debug_e2e_test.go
debug_test.go
debug.go
debugssh_test.go
debugssh.go
dns_proxy_test.go
dns_proxy.go
engine_test.go
engine.go
image_test.go
image.go
models_test.go
models.go
narinfo.go
netns_wrapper.sh.tmpl
networking.go
nixos_toplevel.go
placement_linux.go
qemu_lifetime_test.go
qemu.go
README.md
runner.go
start-test-substituter.sh
substituter_proxy_test.go
substituter_proxy.go
substituter_upload_attic_test.go
substituter_upload_attic.go
substituter_upload_http.go
substituter_upload_nix_store_test.go
substituter_upload_nix_store.go
substituter_upload_proxy_test.go
substituter_upload_proxy.go
test-spindle-microvm.sh
upload_quota_test.go
upload_staging.go
upload_store_path_test.go
vm_test.go
vm.go
README.md
# spindle microVM engine This document describes the architecture of the microvm engine for spindle. In short it allows the spindle to spin up microvm guests, and implements a guest [agent protocol](../../agentproto) for communicating with those guests (via the [shuttle](../../../shuttle) implementation of that proto). It implements some fairly simple resource budgeting and optionally sets up cgroups for better enforcing resource limits, and hardens the VM network access. It has Nix cache integration for any paths built in the VM, those will get pushed to a Nix cache by the spindle (if one is configured). The runner is abstracted behind an interface; right now only the QEMU microVM impl is supported, but others (e.g. firecracker) can slot in later. Currently two kinds of images are supported: - NixOS images: these allow configuration such as `dependencies`, `services`, `virtualisation`, `registry`, `substituters` in the workflow file itself. The guest agent will build (or if it's cached, spindle will send the store path for realization) and activate it before any workflow steps are ran. - Non-NixOS: this is just Alpine & AlmaLinux for now, but can be anything else. Workflow-level configuration like NixOS aren't supported while using these. If Nix exists inside the image (like in our Alpine image) it will still be able to make use of the spindle cache. (For testing, you can run `bash spindle/engines/microvm/test-spindle-microvm.sh` from repo root. These test Alpine, AlmaLinux, and NixOS, and features like if Docker works, public internet is reachable, and so on.) ## Image builds Image builds right now are done via Nix: - For NixOS, we use [microvm.nix](https://github.com/microvm-nix/microvm.nix), and layer our own configs on-top, see [here](../../../nix/microvm). - For Alpine and AlmaLinux we have a small-ish Nix definition that includes fetching the kernel, initrd, kernel modules; setting up the init system that configures the VM proper; copying dependencies (like `nix` or `git`) into a …