firecracker

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package firecracker implements a Firecracker-based Provider. It supports a remote HTTP host-agent client and a stub in-memory fallback for dev/tests so Fleet/Boot can remain provider-agnostic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BaseURL     string       // host agent base URL, e.g. https://agent.local
	Token       string       // bearer token for auth
	HTTPClient  *http.Client // optional; defaults to http.DefaultClient
	UseStub     bool         // force in-memory stub (for dev/tests)
	DownloadURL string       // optional URL to fetch the guest agent binary (forwarded to /start-agent)
}

Config configures the Firecracker provider client.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements orchestrator.Provider backed by a Firecracker host agent API. If UseStub is true or BaseURL is empty, it falls back to an in-memory stub that simulates behavior without real microVMs.

func New

func New(cfg Config) *Provider

New creates a Firecracker provider.

The default HTTP client comes from hostwire: dedicated dial, TLS, response-header, and overall timeouts, and a redirect policy that refuses to follow a host agent somewhere else. http.DefaultClient has no timeout, so an unresponsive host would hold a provider call open indefinitely.

func (*Provider) Capacity added in v0.4.0

func (p *Provider) Capacity(ctx context.Context) (orchestrator.HostCapacity, error)

Capacity implements orchestrator.CapacityProber by asking the host agent for its real CPU count, total RAM, and free disk via GET /v1/capacity. Not supported in stub mode: there is no real hardware for the in-memory stub to report on.

func (*Provider) Close

func (p *Provider) Close() error

Close releases resources.

func (*Provider) Create

Create provisions a new sandbox.

func (*Provider) CreateFromCheckpoint added in v0.4.0

func (p *Provider) CreateFromCheckpoint(ctx context.Context, spec orchestrator.Spec, srcVMID, checkpointID string) (orchestrator.Environment, error)

CreateFromCheckpoint provisions a brand-new sandbox seeded from an existing vm's checkpoint, satisfying orchestrator.SnapshotForkable. The host agent copies the named snapshot's rootfs into the new vm rather than the base image; the source vm is untouched and keeps running.

The returned Environment is a fully usable handle for the NEW vm (its own id and url), not a view of the source. It carries no auth token: the guest's disk still holds whatever credentials the source had, so ForkEnvironment mints fresh ones for the fork rather than letting two vms share a secret.

func (*Provider) Destroy

func (p *Provider) Destroy(ctx context.Context, name string) error

Destroy tears down a sandbox.

func (*Provider) Get

Get returns an existing sandbox.

func (*Provider) List

func (p *Provider) List(ctx context.Context, prefix string) ([]orchestrator.Environment, error)

List returns all sandboxes matching the given prefix.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL