How volantvm/volant works
Project Type & Purpose
• Volant is a microVM orchestration engine written in Go.
• It comprises a control plane (volantd), a CLI (volar + helpers), an in-guest agent/init (kestrel), a dataplane daemon (driftd), and a plugin builder (fledge).
• It orchestrates real VM isolation (cloud hypervisor, VFIO, cloud-init), network (Linux bridge + eBPF), and plugin artifacts (initramfs/rootfs).
Top-Level Components
a. volar (CLI)
• Commands: volar vms, volar plugins, volar deployments.
• Uses the OpenAPI/REST API exposed by volantd.
• Contains sub-packages for standard CLI behavior and openapi-export.
b. volantd (Control Plane)
• REST & MCP APIs (OpenAPI spec in internal/server/httpapi).
• SQLite registry (internal/server/db/sqlite).
• IPAM (192.168.127.0/24).
• Orchestrator modules (internal/server/orchestrator): cloudhypervisor launcher, cloud-init builder, network bridge setup, runtime config, events.
• Device manager (VFIO).
• Event bus for internal pub/sub.
• Drift client (internal/server/driftclient) to communicate with dataplane daemon.
• Plugin registry & loader (internal/server/plugins).
c. driftd (Dataplane Daemon)
• Written in Go + C BPF code (internal/drift/bpf).
• Exposes an HTTP API (internal/drift/httpapi) for flow-level policy, filestore, memory tracking.
• Manages L4 load balancing, vsock proxy, etc.
d. kestrel (In-Guest Agent / PID1)
• Lives inside each microVM.
• Sets up the guest environment, proxies vsock to host dataplane, acts as volant.boot agent.
e. fledge (Plugin Builder)
• Self-contained Docker drop-in replacement.
• Uses the Go LLB (low-level build) library to convert OCI images or static binaries into bootable initramfs or rootfs without dockerd, containerd, or runc.
• Outputs signed plugin artifacts (kernels + initramfs/rootfs) ready for volantd to consume.
Data Stores & Artifacts
• SQLite for the control-plane registry.
• Filesystem:
• /var/lib/volant/plugins (artifacts uploaded).
• kernel/bzImage shipped with the repo.
• Manifest Schema (JSON/TOML) describing each plugin.
Interactions & Data Flow
1. Plugin Build Path (offline / CI):
• Developer runs fledge → pulls OCI image / binary → uses LLB engine → emits initramfs or rootfs + manifest → publishes to artifact store.
2. Plugin Registration:
• volar plugins install --manifest <URL> → calls volantd API → stores artifact metadata and blobs.
3. VM Lifecycle:
• volar vms create → calls volantd → orchestrator:
• Allocates IP from IPAM.
• Configures Linux bridge (vbr0).
• Launches Cloud Hypervisor with kernel/initramfs.
• Passes vsock and VFIO device configs.
• Cloud Hypervisor boots VM → kestrel runs as PID1.
• kestrel sets up cloud-init, mounts rootfs, starts workload.
• Workload vsock traffic proxied via kestrel to driftd on host → dataplane policies applied.
4. Runtime Ops:
• volar / external UI ↔ volantd API ↔ orchestrator.
• volantd ↔ driftd for network dataplane.
• Internally, volantd uses eventbus to trigger plugin hooks, metrics, cloud-init progress.
Architectural Patterns & Principles
• Modularity: separate binaries for CLI, control plane, agent, dataplane, builder.
• Microservices-style: control plane exposes HTTP API, dataplane daemon runs separately.
• Layering: CLI ←→ Control Plane ←→ Orchestrator + Dataplane ←→ Hypervisor ←→ Guest Agent.
• Plugin-first: all VM behaviors come from signed manifests/artifacts.
• Bring-Your-Own-Container-Engine: replaced by fledge using LLB.
Putting It All Together
1. Inside:
• Linux bridge (vbr0) connecting to VMs.
• Cloud Hypervisor instances spinning up microVMs.