ociruntime

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package ociruntime implements the persistent OCI lifecycle used by container engines to run MicroVM workloads.

Index

Constants

View Source
const (
	OCIVersion = "1.2.0"
)

Variables

This section is empty.

Functions

func BuildGuestInitramfs

func BuildGuestInitramfs(bundle string, config Config) (string, func(), error)

BuildGuestInitramfs snapshots Podman's already-materialized rootfs through os.Root confinement, injects the project-owned PID 1 and the OCI entrypoint, then creates the deterministic archive consumed by the native VMM.

func LaunchSupervisor

func LaunchSupervisor(ctx context.Context, store *Store, id, executable, pidFile string) error

func ServeSupervisor

func ServeSupervisor(ctx context.Context, store *Store, id string, readyFD int) (err error)

Types

type Capabilities

type Capabilities struct {
	Bounding    []string `json:"bounding,omitempty"`
	Effective   []string `json:"effective,omitempty"`
	Inheritable []string `json:"inheritable,omitempty"`
	Permitted   []string `json:"permitted,omitempty"`
	Ambient     []string `json:"ambient,omitempty"`
}

type Config

type Config struct {
	OCIVersion  string            `json:"ociVersion"`
	Root        Root              `json:"root"`
	Process     Process           `json:"process"`
	Hostname    string            `json:"hostname,omitempty"`
	Mounts      []Mount           `json:"mounts,omitempty"`
	Hooks       json.RawMessage   `json:"hooks,omitempty"`
	Linux       json.RawMessage   `json:"linux,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

func LoadConfig

func LoadConfig(bundle string) (Config, error)

type Mount

type Mount struct {
	Destination string   `json:"destination"`
	Type        string   `json:"type,omitempty"`
	Source      string   `json:"source,omitempty"`
	Options     []string `json:"options,omitempty"`
}

type Process

type Process struct {
	Terminal        bool          `json:"terminal,omitempty"`
	User            User          `json:"user"`
	Args            []string      `json:"args"`
	Env             []string      `json:"env,omitempty"`
	Cwd             string        `json:"cwd"`
	Capabilities    *Capabilities `json:"capabilities,omitempty"`
	Rlimits         []Rlimit      `json:"rlimits,omitempty"`
	NoNewPrivileges bool          `json:"noNewPrivileges,omitempty"`
	ApparmorProfile string        `json:"apparmorProfile,omitempty"`
	OOMScoreAdj     *int          `json:"oomScoreAdj,omitempty"`
	SelinuxLabel    string        `json:"selinuxLabel,omitempty"`
}

type Rlimit

type Rlimit struct {
	Type string `json:"type"`
	Hard uint64 `json:"hard"`
	Soft uint64 `json:"soft"`
}

type Root

type Root struct {
	Path     string `json:"path"`
	Readonly bool   `json:"readonly,omitempty"`
}

type State

type State struct {
	OCIVersion string `json:"ociVersion"`
	ID         string `json:"id"`
	Status     string `json:"status"`
	PID        int    `json:"pid"`
	// PIDStartTicks distinguishes this process from a later reuse of PID.
	// Zero preserves compatibility with state created before this field existed.
	PIDStartTicks int64             `json:"pidStartTicks,omitempty"`
	Bundle        string            `json:"bundle"`
	Created       time.Time         `json:"created"`
	ExitStatus    *uint32           `json:"exitStatus,omitempty"`
	ExitedAt      *time.Time        `json:"exitedAt,omitempty"`
	Annotations   map[string]string `json:"annotations,omitempty"`
	Metrics       *VMMMetrics       `json:"metrics,omitempty"`
}

type Store

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

func OpenStore

func OpenStore(dir string) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Create

func (s *Store) Create(ctx context.Context, id, bundle string) (State, error)

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string, force bool) error

func (*Store) Dir

func (s *Store) Dir() string

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (State, bool, error)

func (*Store) Kill

func (s *Store) Kill(ctx context.Context, id string, signal syscall.Signal) error

func (*Store) List

func (s *Store) List(ctx context.Context) ([]State, error)

List returns the reconciled runtime states in stable ID order. State files are the only source of truth; lock files, control sockets and interrupted temporary writes are never surfaced as workloads.

func (*Store) SetExited

func (s *Store) SetExited(ctx context.Context, id string, status uint32, exitedAt time.Time) error

SetExited atomically publishes the terminal guest process result.

func (*Store) SetStatus

func (s *Store) SetStatus(ctx context.Context, id, status string) error

func (*Store) SetSupervisor

func (s *Store) SetSupervisor(ctx context.Context, id string, pid int) error

func (*Store) Start

func (s *Store) Start(ctx context.Context, id string) error

type User

type User struct {
	UID            uint32   `json:"uid"`
	GID            uint32   `json:"gid"`
	AdditionalGids []uint32 `json:"additionalGids,omitempty"`
	Username       string   `json:"username,omitempty"`
	Umask          *uint32  `json:"umask,omitempty"`
}

type VMMMetrics

type VMMMetrics struct {
	APIVersion string `json:"api_version"`
	RuntimeMS  int64  `json:"runtime_ms"`
	MemoryMiB  int    `json:"memory_mib"`
	VCPUs      int    `json:"vcpus"`
	ExitStatus uint32 `json:"exit_status"`
}

VMMMetrics is terminal, durable telemetry embedded in the canonical runtime state rather than maintained in a second sidecar store.

Jump to

Keyboard shortcuts

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