ocispec

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ocispec builds the runtime-neutral OCI spec for actor bundles, which each worker shapes for its runtime.

Index

Constants

View Source
const (
	// GuestSharedDir is where the kata agent mounts the share in the guest.
	GuestSharedDir = "/run/kata-containers/shared/containers"
	// ShareDurable, ShareCSI and ShareSystemInfo hold one subdirectory per
	// volume; ShareVolumes holds a container's image volumes at
	// <containerID>/volumes/<name>.
	ShareDurable    = "durable"
	ShareCSI        = "csi"
	ShareSystemInfo = "system-info"
	ShareVolumes    = "volumes"
)

Sub-share names inside the micro-VM virtio-fs share.

View Source
const Hostname = "actor"

Hostname is the UTS hostname for actor containers.

View Source
const SandboxID = "_sandbox"

SandboxID is the runsc ID of the sandbox. runsc creates it with -no-root-container, so it has no process and no rootfs. The underscore keeps it outside the k8s-short-name an ActorTemplate container name is drawn from, so no actor container can collide with it.

Variables

This section is empty.

Functions

func Build

func Build(o Options) *specs.Spec

Build returns a runtime-neutral OCI spec for an actor container.

func BuildSandbox

func BuildSandbox(actorUID string) *specs.Spec

BuildSandbox returns the OCI spec of a sandbox with no root container: the hostname and namespaces, and no process, rootfs, or mounts.

func GVisorCgroupLeaf

func GVisorCgroupLeaf(actorUID, containerName string) string

GVisorCgroupLeaf names an actor container's cgroup relative to the pod scope.

func GuestContainerID

func GuestContainerID(name string) string

GuestContainerID returns the kata container ID for a container name.

kata requires IDs of at least two characters, and a name can be one. '_' is not valid in a name, so the ID can't collide with another name or the Share* dirs. It must only depend on the name, since a restored guest keeps the IDs it booted with. https://github.com/kata-containers/kata-containers/blob/4.1.0/src/libs/kata-sys-util/src/validate.rs#L17-L22

func Save

func Save(bundlePath string, spec *specs.Spec) error

Save writes spec as the OCI spec of the bundle at bundlePath.

func ShapeGVisor

func ShapeGVisor(spec *specs.Spec, o GVisorOptions)

ShapeGVisor adds runsc CRI annotations, durable-dir mount hints, and per-container cgroups to the spec, caps /tmp at half the memory limit, and drops mounts and mount options runsc supplies or ignores. It is idempotent.

func ShapeMicroVM

func ShapeMicroVM(spec *specs.Spec, o MicroVMOptions) error

ShapeMicroVM repoints volume bind mounts to guest share paths, applies containerd's default read-only paths and the subset of its default masked paths that exists in the guest, fills in kata's default resources, and lifts the guest's privileged-port limit. It must run on an unshaped spec, and errors on a bind it cannot place in the guest.

Types

type GVisorOptions

type GVisorOptions struct {
	ActorUID      string
	ActorDirs     *ateworkerpb.ActorDirs
	ContainerName string
	// DurableVolumes are declared on the sandbox spec only.
	DurableVolumes []string
	// Size sizes the container's cgroup leaf and caps its /tmp. Only gVisor
	// applies it; a microVM container's limits come from its own declared
	// resources (see sizing).
	Size sizing.SandboxSize
}

GVisorOptions describes the gVisor-specific context of one actor container.

type MicroVMOptions

type MicroVMOptions struct {
	// ActorDirs are the actor's directories; volume bind sources under them are
	// staged into the share.
	ActorDirs     *ateworkerpb.ActorDirs
	ContainerName string
}

MicroVMOptions describes the micro-VM context of one actor container.

type Options

type Options struct {
	// ActorUID names the actor's network namespace.
	ActorUID string
	// ActorDirs are the actor's directories the bind mount sources are joined
	// from, one subdirectory per volume name.
	ActorDirs *ateworkerpb.ActorDirs
	// Container carries the process and its volume mounts.
	Container *ateworkerpb.Container
}

Options describes one actor container.

Jump to

Keyboard shortcuts

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