runtime

package
v0.0.0-...-13d8f12 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 18 Imported by: 1 module, 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

Index

Constants

View Source
const (
	ManagedHostsVersion            = 1
	ManagedHostsStateFile          = "managed-hosts.json"
	RootfsSeedName                 = "rootfs-seed.tar"
	GVisorRootfsTarUpperAnnotation = "dev.gvisor.tar.rootfs.upper"

	ManagedHostsContentLimit = 64 << 10
)
View Source
const (
	// IgnoreResourceFieldAnnoKey , if set, will ignore the resource field in spec.
	IgnoreResourceFieldAnnoKey = "sandbox.akernel.dev/ignore-resource-field"

	// NetworkClassAnnoKey is the key of network class annotation.
	NetworkClassAnnoKey = "sandbox.akernel.dev/network-class"

	// GVisorRootfsAnnotationPrefix prefixes rootfs image annotations consumed by runsc.
	// GVisorRootfsTypeEROFS identifies EROFS-backed rootfs images.
	GVisorRootfsAnnotationPrefix = "dev.gvisor.spec.rootfs."
	GVisorRootfsTypeEROFS        = "erofs"
)
View Source
const DefaultSandboxHostname = "akernel"

Variables

This section is empty.

Functions

func CreateRootfsMountTargets

func CreateRootfsMountTargets(root string, mounts []Mount) error

CreateRootfsMountTargets seeds mount points in a new per-sandbox upper or placeholder directory. Callers must not pass a shared image rootfs here.

func EffectiveRootReadonly

func EffectiveRootReadonly(readonly bool, writableLimit uint64, updates *SpecUpdates) bool

EffectiveRootReadonly preserves the existing quota and provider-root rules. The runsc NVIDIA hook already requires a writable final rootfs view.

func ManagedRootfsAnnotation

func ManagedRootfsAnnotation(key string) bool

ManagedRootfsAnnotation is reserved even when a request does not select the writable hosts layout: user/provider annotations must not inject arbitrary tar.

func RootfsMountTargetsReady

func RootfsMountTargetsReady(bundlePath string, spec *Spec) (bool, error)

RootfsMountTargetsReady checks a lower rootfs without following symlinks. A symlinked component is treated as requiring a private upper entry so privileged preparation never writes through an untrusted image symlink.

func ValidateInitialFiles

func ValidateInitialFiles(files []InitialFile) error

ValidateInitialFiles keeps the internal channel restricted to managed hosts.

func ValidateManagedHostsCompatibility

func ValidateManagedHostsCompatibility(state *ManagedHostsState, runtimeName string, rootReadonly, ownsHosts bool) error

ValidateManagedHostsCompatibility prevents layout changes during restore. ownsHosts describes caller/base-spec mounts before platform defaults are added.

func ValidateManagedHostsState

func ValidateManagedHostsState(state *ManagedHostsState) error

ValidateManagedHostsState validates a completed, persistable state. Fresh runsc initialization must fill Seed before calling this function.

func ValidateMountDestinations

func ValidateMountDestinations(destinations []string) error

ValidateMountDestinations validates one configuration layer. Cross-layer overrides are resolved separately; duplicates within a layer are errors. Only container destinations are subject to this canonical-path contract. Host source paths retain their original resolution, including symlinks and trailing '/'.

func WriteManagedHostsState

func WriteManagedHostsState(dir string, state *ManagedHostsState) (retErr error)

WriteManagedHostsState publishes durable metadata before reporting success.

Types

type Arch

type Arch string

Arch used for additional architectures

const (
	ArchX86         Arch = "SCMP_ARCH_X86"
	ArchX86_64      Arch = "SCMP_ARCH_X86_64"
	ArchX32         Arch = "SCMP_ARCH_X32"
	ArchARM         Arch = "SCMP_ARCH_ARM"
	ArchAARCH64     Arch = "SCMP_ARCH_AARCH64"
	ArchMIPS        Arch = "SCMP_ARCH_MIPS"
	ArchMIPS64      Arch = "SCMP_ARCH_MIPS64"
	ArchMIPS64N32   Arch = "SCMP_ARCH_MIPS64N32"
	ArchMIPSEL      Arch = "SCMP_ARCH_MIPSEL"
	ArchMIPSEL64    Arch = "SCMP_ARCH_MIPSEL64"
	ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32"
	ArchPPC         Arch = "SCMP_ARCH_PPC"
	ArchPPC64       Arch = "SCMP_ARCH_PPC64"
	ArchPPC64LE     Arch = "SCMP_ARCH_PPC64LE"
	ArchS390        Arch = "SCMP_ARCH_S390"
	ArchS390X       Arch = "SCMP_ARCH_S390X"
	ArchPARISC      Arch = "SCMP_ARCH_PARISC"
	ArchPARISC64    Arch = "SCMP_ARCH_PARISC64"
	ArchRISCV64     Arch = "SCMP_ARCH_RISCV64"
)

Additional architectures permitted to be used for system calls By default only the native architecture of the kernel is permitted

type Box

type Box struct {
	// Height is the vertical dimension of a box.
	Height uint `json:"height"`
	// Width is the horizontal dimension of a box.
	Width uint `json:"width"`
}

Box specifies dimensions of a rectangle. Used for specifying the size of a console.

func (*Box) DeepCopy

func (b *Box) DeepCopy() *Box

DeepCopy returns a deep copy of the Box structure.

type BundleLoader

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

BundleLoader loads an OCI base spec and materializes per-sandbox bundle directories for runsc.

func NewBundleLoader

func NewBundleLoader(baseFile, bundleDir string) (*BundleLoader, error)

func (*BundleLoader) GenerateOci

func (r *BundleLoader) GenerateOci(options OciLoadOptions) (string, *Spec, error)

func (*BundleLoader) SandboxDefaults

func (r *BundleLoader) SandboxDefaults() SandboxDefaults

type CheckpointConfig

type CheckpointConfig struct {
	ID        string
	Directory string
	// CgroupPath is the runtime-owned source cgroup. It is internal runtime
	// metadata rather than a public checkpoint option.
	CgroupPath   string
	Compress     bool
	LeaveRunning bool
	// SnapshotType requests a specific checkpoint flavor ("Full",
	// "Incremental", or "SoftDirty" for Firecracker); empty leaves the
	// runtime's automatic tier selection in charge. Runtimes without
	// incremental checkpoints ignore it.
	SnapshotType string
}

type CheckpointHandler

type CheckpointHandler interface {
	Checkpoint(context.Context, CheckpointConfig) error
	Restore(context.Context, StartConfig) error
}

CheckpointHandler is an optional capability implemented by runtimes that can save and restore caller-owned checkpoint artifacts.

type CheckpointRestoreCapabilities

type CheckpointRestoreCapabilities struct {
	CheckpointHandoffPath string
	RestoreEnvPath        string
}

CheckpointRestoreCapabilities describes the optional application-facing handoff interface exposed inside a restored sandbox. Empty paths mean the runtime supports transparent checkpoint/restore without application help.

type CheckpointRestoreCapabilitiesProvider

type CheckpointRestoreCapabilitiesProvider interface {
	CheckpointRestoreCapabilities() CheckpointRestoreCapabilities
}

CheckpointRestoreCapabilitiesProvider optionally describes the guest-facing application handoff exposed by a CheckpointHandler.

type Exit

type Exit struct {
	ExitedAt time.Time
	ExitCode int
}

type FakeRuntimeHandler

type FakeRuntimeHandler struct{}

func NewFakeRuntimeHandler

func NewFakeRuntimeHandler() *FakeRuntimeHandler

func (*FakeRuntimeHandler) Delete

func (f *FakeRuntimeHandler) Delete(ctx context.Context, _ string) error

func (*FakeRuntimeHandler) List

func (f *FakeRuntimeHandler) List(ctx context.Context) ([]*State, error)

func (*FakeRuntimeHandler) Start

func (*FakeRuntimeHandler) Wait

func (f *FakeRuntimeHandler) Wait(ctx context.Context, _ string) (Exit, error)

type Handler

type Handler interface {
	Start(context.Context, StartConfig) error
	Delete(context.Context, string) error
	List(context.Context) ([]*State, error)
	Wait(context.Context, string) (Exit, error)
}

Handler is the lifecycle boundary implemented by sandbox runtimes.

type Hook

type Hook struct {
	Path    string   `json:"path"`
	Args    []string `json:"args,omitempty"`
	Env     []string `json:"env,omitempty"`
	Timeout *int     `json:"timeout,omitempty"`
}

Hook specifies a command that is run at a particular event in the lifecycle of a container

func (*Hook) DeepCopy

func (h *Hook) DeepCopy() *Hook

DeepCopy returns a deep copy of the Hook structure.

type Hooks

type Hooks struct {
	// Prestart is Deprecated. Prestart is a list of hooks to be run before the container process is executed.
	// It is called in the Runtime Namespace
	Prestart []Hook `json:"prestart,omitempty"`
	// CreateRuntime is a list of hooks to be run after the container has been created but before pivot_root or any equivalent operation has been called
	// It is called in the Runtime Namespace
	CreateRuntime []Hook `json:"createRuntime,omitempty"`
	// CreateContainer is a list of hooks to be run after the container has been created but before pivot_root or any equivalent operation has been called
	// It is called in the Container Namespace
	CreateContainer []Hook `json:"createContainer,omitempty"`
	// StartContainer is a list of hooks to be run after the start operation is called but before the container process is started
	// It is called in the Container Namespace
	StartContainer []Hook `json:"startContainer,omitempty"`
	// Poststart is a list of hooks to be run after the container process is started.
	// It is called in the Runtime Namespace
	Poststart []Hook `json:"poststart,omitempty"`
	// Poststop is a list of hooks to be run after the container process exits.
	// It is called in the Runtime Namespace
	Poststop []Hook `json:"poststop,omitempty"`
}

Hooks specifies a command that is run in the container at a particular event in the lifecycle of a container Hooks for container setup and teardown

func (*Hooks) DeepCopy

func (h *Hooks) DeepCopy() *Hooks

DeepCopy returns a deep copy of the Hooks structure.

type HostResourcesProvider

type HostResourcesProvider interface {
	HostResources(*runtime.LinuxSandboxResources) *runtime.LinuxSandboxResources
}

HostResourcesProvider maps guest-visible resources to the host cgroup that encloses a runtime process. VM handlers use it to retain private VMM headroom without changing resources exposed to the guest.

type HostsLayout

type HostsLayout string
const (
	HostsLayoutPrivateRootfs HostsLayout = "managed_rootfs_v1"
	HostsLayoutLegacy        HostsLayout = "legacy_readonly_mount"
	HostsLayoutExternal      HostsLayout = "external_mount"
)

type InitialFile

type InitialFile struct {
	Path    string
	Content []byte
	Mode    uint32
}

InitialFile is an internal initialization instruction, not a host mount.

type Linux

type Linux struct {
	// UIDMapping specifies user mappings for supporting user namespaces.
	UIDMappings []LinuxIDMapping `json:"uidMappings,omitempty"`
	// GIDMapping specifies group mappings for supporting user namespaces.
	GIDMappings []LinuxIDMapping `json:"gidMappings,omitempty"`
	// Sysctl are a set of key value pairs that are set for the container on start
	Sysctl map[string]string `json:"sysctl,omitempty"`
	// Resources contain cgroup information for handling resource constraints
	// for the container
	Resources *LinuxResources `json:"resources,omitempty"`
	// CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
	// The path is expected to be relative to the cgroups mountpoint.
	// If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
	CgroupsPath string `json:"cgroupsPath,omitempty"`
	// Namespaces contains the namespaces that are created and/or joined by the container
	Namespaces []LinuxNamespace `json:"namespaces,omitempty"`
	// Devices are a list of device nodes that are created for the container
	Devices []LinuxDevice `json:"devices,omitempty"`
	// Seccomp specifies the seccomp security settings for the container.
	Seccomp *LinuxSeccomp `json:"seccomp,omitempty"`
	// RootfsPropagation is the rootfs mount propagation mode for the container.
	RootfsPropagation string `json:"rootfsPropagation,omitempty"`
	// MaskedPaths masks over the provided paths inside the container.
	MaskedPaths []string `json:"maskedPaths,omitempty"`
	// ReadonlyPaths sets the provided paths as RO inside the container.
	ReadonlyPaths []string `json:"readonlyPaths,omitempty"`
	// MountLabel specifies the selinux context for the mounts in the container.
	MountLabel string `json:"mountLabel,omitempty"`
	// IntelRdt contains Intel Resource Director Technology (RDT) information for
	// handling resource constraints (e.g., L3 cache, memory bandwidth) for the container
	IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"`
	// Personality contains configuration for the Linux personality syscall
	Personality *LinuxPersonality `json:"personality,omitempty"`
}

Linux contains platform-specific configuration for Linux based containers.

func (*Linux) DeepCopy

func (l *Linux) DeepCopy() *Linux

DeepCopy returns a deep copy of the Linux structure.

type LinuxBlockIO

type LinuxBlockIO struct {
	// Specifies per cgroup weight
	Weight *uint16 `json:"weight,omitempty"`
	// Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, CFQ scheduler only
	LeafWeight *uint16 `json:"leafWeight,omitempty"`
	// Weight per cgroup per device, can override BlkioWeight
	WeightDevice []LinuxWeightDevice `json:"weightDevice,omitempty"`
	// IO read rate limit per cgroup per device, bytes per second
	ThrottleReadBpsDevice []LinuxThrottleDevice `json:"throttleReadBpsDevice,omitempty"`
	// IO write rate limit per cgroup per device, bytes per second
	ThrottleWriteBpsDevice []LinuxThrottleDevice `json:"throttleWriteBpsDevice,omitempty"`
	// IO read rate limit per cgroup per device, IO per second
	ThrottleReadIOPSDevice []LinuxThrottleDevice `json:"throttleReadIOPSDevice,omitempty"`
	// IO write rate limit per cgroup per device, IO per second
	ThrottleWriteIOPSDevice []LinuxThrottleDevice `json:"throttleWriteIOPSDevice,omitempty"`
}

LinuxBlockIO for Linux cgroup 'blkio' resource management

func (*LinuxBlockIO) DeepCopy

func (i *LinuxBlockIO) DeepCopy() *LinuxBlockIO

type LinuxCPU

type LinuxCPU struct {
	// CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
	Shares *uint64 `json:"shares,omitempty"`
	// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
	Quota *int64 `json:"quota,omitempty"`
	// CPU period to be used for hardcapping (in usecs).
	Period *uint64 `json:"period,omitempty"`
	// How much time realtime scheduling may use (in usecs).
	RealtimeRuntime *int64 `json:"realtimeRuntime,omitempty"`
	// CPU period to be used for realtime scheduling (in usecs).
	RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"`
	// CPUs to use within the cpuset. Default is to use any CPU available.
	Cpus string `json:"cpus,omitempty"`
	// List of memory nodes in the cpuset. Default is to use any available memory node.
	Mems string `json:"mems,omitempty"`
}

LinuxCPU for Linux cgroup 'cpu' resource management

func (*LinuxCPU) DeepCopy

func (c *LinuxCPU) DeepCopy() *LinuxCPU

type LinuxCapabilities

type LinuxCapabilities struct {
	// Bounding is the set of capabilities checked by the kernel.
	Bounding []string `json:"bounding,omitempty" platform:"linux"`
	// Effective is the set of capabilities checked by the kernel.
	Effective []string `json:"effective,omitempty" platform:"linux"`
	// Inheritable is the capabilities preserved across execve.
	Inheritable []string `json:"inheritable,omitempty" platform:"linux"`
	// Permitted is the limiting superset for effective capabilities.
	Permitted []string `json:"permitted,omitempty" platform:"linux"`
	// Ambient is the ambient set of capabilities that are kept.
	Ambient []string `json:"ambient,omitempty" platform:"linux"`
}

LinuxCapabilities specifies the list of allowed capabilities that are kept for a process. http://man7.org/linux/man-pages/man7/capabilities.7.html

func (*LinuxCapabilities) DeepCopy

func (l *LinuxCapabilities) DeepCopy() *LinuxCapabilities

DeepCopy returns a deep copy of the LinuxCapabilities structure.

type LinuxDevice

type LinuxDevice struct {
	// Path to the device.
	Path string `json:"path"`
	// Device type, block, char, etc.
	Type string `json:"type"`
	// Major is the device's major number.
	Major int64 `json:"major"`
	// Minor is the device's minor number.
	Minor int64 `json:"minor"`
	// FileMode permission bits for the device.
	FileMode *os.FileMode `json:"fileMode,omitempty"`
	// UID of the device.
	UID *uint32 `json:"uid,omitempty"`
	// Gid of the device.
	GID *uint32 `json:"gid,omitempty"`
}

LinuxDevice represents the mknod information for a Linux special device file

func (*LinuxDevice) DeepCopy

func (d *LinuxDevice) DeepCopy() *LinuxDevice

type LinuxDeviceCgroup

type LinuxDeviceCgroup struct {
	// Allow or deny
	Allow bool `json:"allow"`
	// Device type, block, char, etc.
	Type string `json:"type,omitempty"`
	// Major is the device's major number.
	Major *int64 `json:"major,omitempty"`
	// Minor is the device's minor number.
	Minor *int64 `json:"minor,omitempty"`
	// Cgroup access permissions format, rwm.
	Access string `json:"access,omitempty"`
}

LinuxDeviceCgroup represents a device rule for the devices specified to the device controller

func (*LinuxDeviceCgroup) DeepCopy

func (c *LinuxDeviceCgroup) DeepCopy() *LinuxDeviceCgroup

type LinuxHugepageLimit

type LinuxHugepageLimit struct {
	// Pagesize is the hugepage size
	// Format: "<size><unit-prefix>B' (e.g. 64KB, 2MB, 1GB, etc.)
	Pagesize string `json:"pageSize"`
	// Limit is the limit of "hugepagesize" hugetlb usage
	Limit uint64 `json:"limit"`
}

LinuxHugepageLimit structure corresponds to limiting kernel hugepages

type LinuxIDMapping

type LinuxIDMapping struct {
	// ContainerID is the starting UID/GID in the container
	ContainerID uint32 `json:"containerID"`
	// HostID is the starting UID/GID on the host to be mapped to 'ContainerID'
	HostID uint32 `json:"hostID"`
	// Size is the number of IDs to be mapped
	Size uint32 `json:"size"`
}

LinuxIDMapping specifies UID/GID mappings

func (*LinuxIDMapping) DeepCopy

func (m *LinuxIDMapping) DeepCopy() *LinuxIDMapping

type LinuxIntelRdt

type LinuxIntelRdt struct {
	// The identity for RDT Class of Service
	ClosID string `json:"closID,omitempty"`
	// The schema for L3 cache id and capacity bitmask (CBM)
	// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
	L3CacheSchema string `json:"l3CacheSchema,omitempty"`

	// The schema of memory bandwidth per L3 cache id
	// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."
	// The unit of memory bandwidth is specified in "percentages" by
	// default, and in "MBps" if MBA Software Controller is enabled.
	MemBwSchema string `json:"memBwSchema,omitempty"`
}

LinuxIntelRdt has container runtime resource constraints for Intel RDT CAT and MBA features which introduced in Linux 4.10 and 4.12 kernel

func (*LinuxIntelRdt) DeepCopy

func (r *LinuxIntelRdt) DeepCopy() *LinuxIntelRdt

type LinuxInterfacePriority

type LinuxInterfacePriority struct {
	// Name is the name of the network interface
	Name string `json:"name"`
	// Priority for the interface
	Priority uint32 `json:"priority"`
}

LinuxInterfacePriority for network interfaces

type LinuxMemory

type LinuxMemory struct {
	// Memory limit (in bytes).
	Limit *int64 `json:"limit,omitempty"`
	// Memory reservation or soft_limit (in bytes).
	Reservation *int64 `json:"reservation,omitempty"`
	// Total memory limit (memory + swap).
	Swap *int64 `json:"swap,omitempty"`
	// Kernel memory limit (in bytes).
	Kernel *int64 `json:"kernel,omitempty"`
	// Kernel memory limit for tcp (in bytes)
	KernelTCP *int64 `json:"kernelTCP,omitempty"`
	// How aggressive the kernel will swap memory pages.
	Swappiness *uint64 `json:"swappiness,omitempty"`
	// DisableOOMKiller disables the OOM killer for out of memory conditions
	DisableOOMKiller *bool `json:"disableOOMKiller,omitempty"`
	// Enables hierarchical memory accounting
	UseHierarchy *bool `json:"useHierarchy,omitempty"`
}

LinuxMemory for Linux cgroup 'memory' resource management

func (*LinuxMemory) DeepCopy

func (m *LinuxMemory) DeepCopy() *LinuxMemory

type LinuxNamespace

type LinuxNamespace struct {
	// Type is the type of namespace
	Type LinuxNamespaceType `json:"type"`
	// Path is a path to an existing namespace persisted on disk that can be joined
	// and is of the same type
	Path string `json:"path,omitempty"`
}

LinuxNamespace is the configuration for a Linux namespace

func (*LinuxNamespace) DeepCopy

func (n *LinuxNamespace) DeepCopy() *LinuxNamespace

type LinuxNamespaceType

type LinuxNamespaceType string

LinuxNamespaceType is one of the Linux namespaces

const (
	// PIDNamespace for isolating process IDs
	PIDNamespace LinuxNamespaceType = "pid"
	// NetworkNamespace for isolating network devices, stacks, ports, etc
	NetworkNamespace LinuxNamespaceType = "network"
	// MountNamespace for isolating mount points
	MountNamespace LinuxNamespaceType = "mount"
	// IPCNamespace for isolating System V IPC, POSIX message queues
	IPCNamespace LinuxNamespaceType = "ipc"
	// UTSNamespace for isolating hostname and NIS domain name
	UTSNamespace LinuxNamespaceType = "uts"
	// UserNamespace for isolating user and group IDs
	UserNamespace LinuxNamespaceType = "user"
	// CgroupNamespace for isolating cgroup hierarchies
	CgroupNamespace LinuxNamespaceType = "cgroup"
)

type LinuxNetwork

type LinuxNetwork struct {
	// Set class identifier for container's network packets
	ClassID *uint32 `json:"classID,omitempty"`
	// Set priority of network traffic for container
	Priorities []LinuxInterfacePriority `json:"priorities,omitempty"`
}

LinuxNetwork identification and priority configuration

func (*LinuxNetwork) DeepCopy

func (n *LinuxNetwork) DeepCopy() *LinuxNetwork

type LinuxPersonality

type LinuxPersonality struct {
	// Domain for the personality
	Domain LinuxPersonalityDomain `json:"domain"`
	// Additional flags
	Flags []LinuxPersonalityFlag `json:"flags,omitempty"`
}

LinuxPersonality represents the Linux personality syscall input

func (*LinuxPersonality) DeepCopy

func (p *LinuxPersonality) DeepCopy() *LinuxPersonality

type LinuxPersonalityDomain

type LinuxPersonalityDomain string

LinuxPersonalityDomain refers to a personality domain.

const (
	// PerLinux is the standard Linux personality
	PerLinux LinuxPersonalityDomain = "LINUX"
	// PerLinux32 sets personality to 32 bit
	PerLinux32 LinuxPersonalityDomain = "LINUX32"
)

Define domain and flags for Personality

type LinuxPersonalityFlag

type LinuxPersonalityFlag string

LinuxPersonalityFlag refers to an additional personality flag. None are currently defined.

type LinuxPids

type LinuxPids struct {
	// Maximum number of PIDs. Default is "no limit".
	Limit int64 `json:"limit"`
}

LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3)

func (*LinuxPids) DeepCopy

func (p *LinuxPids) DeepCopy() *LinuxPids

type LinuxRdma

type LinuxRdma struct {
	// Maximum number of HCA handles that can be opened. Default is "no limit".
	HcaHandles *uint32 `json:"hcaHandles,omitempty"`
	// Maximum number of HCA objects that can be created. Default is "no limit".
	HcaObjects *uint32 `json:"hcaObjects,omitempty"`
}

LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11)

type LinuxResources

type LinuxResources struct {
	// Devices configures the device allowlist.
	Devices []LinuxDeviceCgroup `json:"devices,omitempty"`
	// Memory restriction configuration
	Memory *LinuxMemory `json:"memory,omitempty"`
	// CPU resource restriction configuration
	CPU *LinuxCPU `json:"cpu,omitempty"`
	// Task resource restriction configuration.
	Pids *LinuxPids `json:"pids,omitempty"`
	// BlockIO restriction configuration
	BlockIO *LinuxBlockIO `json:"blockIO,omitempty"`
	// Hugetlb limit (in bytes)
	HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
	// Network restriction configuration
	Network *LinuxNetwork `json:"network,omitempty"`
	// Rdma resource restriction configuration.
	// Limits are a set of key value pairs that define RDMA resource limits,
	// where the key is device name and value is resource limits.
	Rdma map[string]LinuxRdma `json:"rdma,omitempty"`
	// Unified resources.
	Unified map[string]string `json:"unified,omitempty"`
}

LinuxResources has container runtime resource constraints

func (*LinuxResources) DeepCopy

func (r *LinuxResources) DeepCopy() *LinuxResources

type LinuxSeccomp

type LinuxSeccomp struct {
	DefaultAction    LinuxSeccompAction `json:"defaultAction"`
	DefaultErrnoRet  *uint              `json:"defaultErrnoRet,omitempty"`
	Architectures    []Arch             `json:"architectures,omitempty"`
	Flags            []LinuxSeccompFlag `json:"flags,omitempty"`
	ListenerPath     string             `json:"listenerPath,omitempty"`
	ListenerMetadata string             `json:"listenerMetadata,omitempty"`
	Syscalls         []LinuxSyscall     `json:"syscalls,omitempty"`
}

LinuxSeccomp represents syscall restrictions

func (*LinuxSeccomp) DeepCopy

func (s *LinuxSeccomp) DeepCopy() *LinuxSeccomp

type LinuxSeccompAction

type LinuxSeccompAction string

LinuxSeccompAction taken upon Seccomp rule match

const (
	ActKill        LinuxSeccompAction = "SCMP_ACT_KILL"
	ActKillProcess LinuxSeccompAction = "SCMP_ACT_KILL_PROCESS"
	ActKillThread  LinuxSeccompAction = "SCMP_ACT_KILL_THREAD"
	ActTrap        LinuxSeccompAction = "SCMP_ACT_TRAP"
	ActErrno       LinuxSeccompAction = "SCMP_ACT_ERRNO"
	ActTrace       LinuxSeccompAction = "SCMP_ACT_TRACE"
	ActAllow       LinuxSeccompAction = "SCMP_ACT_ALLOW"
	ActLog         LinuxSeccompAction = "SCMP_ACT_LOG"
	ActNotify      LinuxSeccompAction = "SCMP_ACT_NOTIFY"
)

Define actions for Seccomp rules

type LinuxSeccompArg

type LinuxSeccompArg struct {
	Index    uint                 `json:"index"`
	Value    uint64               `json:"value"`
	ValueTwo uint64               `json:"valueTwo,omitempty"`
	Op       LinuxSeccompOperator `json:"op"`
}

LinuxSeccompArg used for matching specific syscall arguments in Seccomp

type LinuxSeccompFlag

type LinuxSeccompFlag string

LinuxSeccompFlag is a flag to pass to seccomp(2).

type LinuxSeccompOperator

type LinuxSeccompOperator string

LinuxSeccompOperator used to match syscall arguments in Seccomp

const (
	OpNotEqual     LinuxSeccompOperator = "SCMP_CMP_NE"
	OpLessThan     LinuxSeccompOperator = "SCMP_CMP_LT"
	OpLessEqual    LinuxSeccompOperator = "SCMP_CMP_LE"
	OpEqualTo      LinuxSeccompOperator = "SCMP_CMP_EQ"
	OpGreaterEqual LinuxSeccompOperator = "SCMP_CMP_GE"
	OpGreaterThan  LinuxSeccompOperator = "SCMP_CMP_GT"
	OpMaskedEqual  LinuxSeccompOperator = "SCMP_CMP_MASKED_EQ"
)

Define operators for syscall arguments in Seccomp

type LinuxSyscall

type LinuxSyscall struct {
	Names    []string           `json:"names"`
	Action   LinuxSeccompAction `json:"action"`
	ErrnoRet *uint              `json:"errnoRet,omitempty"`
	Args     []LinuxSeccompArg  `json:"args,omitempty"`
}

LinuxSyscall is used to match a syscall in Seccomp

func (*LinuxSyscall) DeepCopy

func (s *LinuxSyscall) DeepCopy() *LinuxSyscall

type LinuxThrottleDevice

type LinuxThrottleDevice struct {

	// Rate is the IO rate limit per cgroup per device
	Rate uint64 `json:"rate"`
	// contains filtered or unexported fields
}

LinuxThrottleDevice struct holds a `major:minor rate_per_second` pair

type LinuxWeightDevice

type LinuxWeightDevice struct {

	// Weight is the bandwidth rate for the device.
	Weight *uint16 `json:"weight,omitempty"`
	// LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, CFQ scheduler only
	LeafWeight *uint16 `json:"leafWeight,omitempty"`
	// contains filtered or unexported fields
}

LinuxWeightDevice struct holds a `major:minor weight` pair for weightDevice

type ManagedHostsState

type ManagedHostsState struct {
	Version      int         `json:"schema_version"`
	Layout       HostsLayout `json:"hosts_layout"`
	Runtime      string      `json:"runtime"`
	RootReadonly bool        `json:"root_readonly"`
	Seed         *RootfsSeed `json:"seed,omitempty"`
}

ManagedHostsState describes initialization dependencies, never live hosts data. A nil state preserves the behavior of snapshots made before this schema.

func ReadManagedHostsState

func ReadManagedHostsState(dir string) (*ManagedHostsState, error)

ReadManagedHostsState returns nil only for an absent sidecar. Runtime-specific manifest/spec validation must still distinguish missing new state from legacy.

type Mount

type Mount struct {
	// Destination is the absolute path where the mount will be placed in the container.
	Destination string `json:"destination"`
	// Type specifies the mount kind.
	Type string `json:"type,omitempty" platform:"linux,solaris"`
	// Source specifies the source path of the mount.
	Source string `json:"source,omitempty"`
	// Options are fstab style mount options.
	Options []string `json:"options,omitempty"`
}

Mount specifies a mount for a container.

func (*Mount) DeepCopy

func (m *Mount) DeepCopy() *Mount

DeepCopy returns a deep copy of the Mount structure.

type OciLoadOptions

type OciLoadOptions struct {
	SandboxID string
	Config    StartConfig

	CgroupPath        string
	NetworkNameSpace  string
	OverrideBundleDir string

	OverrideRootPath string

	UseGVisorRootfsImageAnnotations bool
	RootfsOverlayDir                string
	RootfsOverlaySize               string
}

type OciLoader

type OciLoader interface {
	GenerateOci(options OciLoadOptions) (string, *Spec, error)
}

type POSIXRlimit

type POSIXRlimit struct {
	// Type of the rlimit to set
	Type string `json:"type"`
	// Hard is the hard limit for the specified type
	Hard uint64 `json:"hard"`
	// Soft is the soft limit for the specified type
	Soft uint64 `json:"soft"`
}

POSIXRlimit type and restrictions

type Process

type Process struct {
	// Terminal creates an interactive terminal for the container.
	Terminal bool `json:"terminal,omitempty"`
	// ConsoleSize specifies the size of the console.
	ConsoleSize *Box `json:"consoleSize,omitempty"`
	// User specifies user information for the process.
	User User `json:"user"`
	// Args specifies the binary and arguments for the application to execute.
	Args []string `json:"args,omitempty"`
	// CommandLine specifies the full command line for the application to execute on Windows.
	CommandLine string `json:"commandLine,omitempty" platform:"windows"`
	// Env populates the process environment for the process.
	Env []string `json:"env,omitempty"`
	// Cwd is the current working directory for the process and must be
	// relative to the container's root.
	Cwd string `json:"cwd"`
	// Capabilities are Linux capabilities that are kept for the process.
	Capabilities *LinuxCapabilities `json:"capabilities,omitempty" platform:"linux"`
	// Rlimits specifies rlimit options to apply to the process.
	Rlimits []POSIXRlimit `json:"rlimits,omitempty" platform:"linux,solaris"`
	// NoNewPrivileges controls whether additional privileges could be gained by processes in the container.
	NoNewPrivileges bool `json:"noNewPrivileges,omitempty" platform:"linux"`
	// ApparmorProfile specifies the apparmor profile for the container.
	ApparmorProfile string `json:"apparmorProfile,omitempty" platform:"linux"`
	// Specify an oom_score_adj for the container.
	OOMScoreAdj *int `json:"oomScoreAdj,omitempty" platform:"linux"`
	// SelinuxLabel specifies the selinux context that the container process is run as.
	SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"`
}

Process contains information to start a specific application inside the container.

func (*Process) DeepCopy

func (p *Process) DeepCopy() *Process

DeepCopy returns a deep copy of the Process structure.

type Root

type Root struct {
	// Path is the absolute path to the container's root filesystem.
	Path string `json:"path"`
	// Readonly makes the root filesystem for the container readonly before the process is executed.
	Readonly bool `json:"readonly,omitempty"`
}

Root contains information about the container's root filesystem on the host.

func (*Root) DeepCopy

func (r *Root) DeepCopy() *Root

DeepCopy returns a deep copy of the Root structure.

type RootfsSeed

type RootfsSeed struct {
	File            string `json:"artifact_path"`
	SHA256          string `json:"sha256"`
	AnnotationKey   string `json:"annotation_key"`
	AnnotationValue string `json:"annotation_value"`
}

type SandboxDefaults

type SandboxDefaults struct {
	Hostname          string
	MountDestinations []string
}

SandboxDefaults contains base-spec values needed by the common sandbox preparation layer before control is handed to a runtime handler.

func LoaderSandboxDefaults

func LoaderSandboxDefaults(loader OciLoader) SandboxDefaults

LoaderSandboxDefaults returns the defaults exposed by an OCI loader.

type SandboxDefaultsProvider

type SandboxDefaultsProvider interface {
	SandboxDefaults() SandboxDefaults
}

SandboxDefaultsProvider is an optional extension implemented by OCI-based handlers. Keeping it separate from Handler preserves compatibility for external and test handlers.

type SandboxStatus

type SandboxStatus string
const (
	// SandboxStatusCreated is the status of a container after it has been created.
	SandboxStatusCreated SandboxStatus = "created"
	// SandboxStatusRunning is the status of a container after it has been started.
	SandboxStatusRunning SandboxStatus = "running"
	// SandboxStatusExited is the status of a container after it has exited.
	SandboxStatusExited SandboxStatus = "stopped"
	// SandboxStatusUnknown is the status of a container when its status cannot be determined.
	SandboxStatusUnknown SandboxStatus = "unknown"
)

type Spec

type Spec struct {
	// Version of the Open Container Initiative Runtime Specification with which the bundle complies.
	Version string `json:"ociVersion"`
	// Process configures the container process.
	Process *Process `json:"process,omitempty"`
	// Root configures the container's root filesystem.
	Root *Root `json:"root,omitempty"`
	// Hostname configures the container's hostname.
	Hostname string `json:"hostname,omitempty"`
	// Mounts configures additional mounts (on top of Root).
	Mounts []Mount `json:"mounts,omitempty"`
	// Hooks configures callbacks for container lifecycle events.
	Hooks *Hooks `json:"hooks,omitempty" platform:"linux,solaris"`
	// Annotations contains arbitrary metadata for the container.
	Annotations map[string]string `json:"annotations,omitempty"`

	// Linux is platform-specific configuration for Linux based containers.
	Linux *Linux `json:"linux,omitempty" platform:"linux"`
}

Spec is the simple-version base only for linux configuration for the container.

func LoadSpec

func LoadSpec(baseFile string) (*Spec, error)

func (*Spec) DeepCopy

func (s *Spec) DeepCopy() *Spec

type SpecUpdates

type SpecUpdates struct {
	Envs        []*runtime.KeyValue
	Prestart    []Hook
	Annotations map[string]string
	// RequiresHostWritableRootfs requests a private writable rootfs view
	// before provider hooks execute. It is separate from the writable layer
	// visible to workloads after the sandbox starts.
	RequiresHostWritableRootfs bool
}

SpecUpdates contains provider-resolved OCI changes. Device providers use this boundary so vendor-specific discovery and authorization do not leak into the runsc client.

type StartConfig

type StartConfig struct {
	ID                      string
	Hostname                string
	Command                 []string
	Mounts                  []*runtime.Mount
	Rootfs                  string
	RootfsReadonly          bool
	Resources               *runtime.LinuxSandboxResources
	Envs                    []*runtime.KeyValue
	Stdout                  string
	Stderr                  string
	Cwd                     string
	CgroupPath              string
	Annotations             map[string]string
	Network                 *networkmanager.NetResource
	DisableCgroup           bool
	SpecUpdates             *SpecUpdates
	WritableLayerLimitBytes uint64
	ExtraConfig             string
	EnableKVM               bool
	CheckpointDir           string
	// InitialFiles are platform-owned gVisor files installed before the first process.
	// Restore must use the saved filesystem state instead of replaying them.
	InitialFiles []InitialFile
	ManagedHosts *ManagedHostsState
}

type StartRequestValidator

type StartRequestValidator interface {
	ValidateStartRequest(*runtime.StartRequest) error
}

StartRequestValidator rejects unsupported request sources before sandboxd prepares images and runtime resources.

type State

type State struct {
	ID             string        `json:"id"`
	InitProcessPid int           `json:"pid"`
	Status         SandboxStatus `json:"status"`
	Created        string        `json:"created"`
}

type User

type User struct {
	// UID is the user id.
	UID uint32 `json:"uid" platform:"linux,solaris"`
	// GID is the group id.
	GID uint32 `json:"gid" platform:"linux,solaris"`
	// Umask is the umask for the init process.
	Umask *uint32 `json:"umask,omitempty" platform:"linux,solaris"`
	// AdditionalGids are additional group ids set for the container's process.
	AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux,solaris"`
	// Username is the user name.
	Username string `json:"username,omitempty" platform:"windows"`
}

User specifies specific user (and group) information for the container process.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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