Documentation
¶
Overview ¶
Package cdi reads a Container Device Interface spec and resolves what a named set of devices asks a container runtime to do.
An ateom cannot leave this to the container runtime. containerd applies CDI to the pod's containers, and an actor's containers are created by the ateom underneath one of them, so whatever hands devices to actors reads the spec itself. That holds for any sandbox, and under DRA too, which names allocated devices as CDI device IDs.
Applying the edits is a separate step and is not generic: it depends on how the sandbox gets an OCI spec and whether it shares the host's device nodes. See cmd/ateom-gvisor/internal/cdiinject for the gVisor one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dev ¶
type Dev struct {
Path string `json:"path"`
Type string `json:"type,omitempty"`
Major int64 `json:"major,omitempty"`
Minor int64 `json:"minor,omitempty"`
}
Dev is a device node to create in the container. Major and Minor are often absent: CDI leaves resolving them to the OCI runtime, which stats the host.
type Device ¶
Device is one addressable device in a spec. Generators name the same underlying hardware several ways -- nvidia-ctk emits per-index ("0"), per-UUID and an "all" device that repeats every node -- so applying every device in a spec injects each node several times over.
type Edits ¶
type Edits struct {
Env []string `json:"env,omitempty"`
DeviceNodes []Dev `json:"deviceNodes,omitempty"`
Mounts []Mount `json:"mounts,omitempty"`
Hooks []Hook `json:"hooks,omitempty"`
}
Edits are the changes a device makes to a container.
type Hook ¶
type Hook struct {
HookName string `json:"hookName"`
Path string `json:"path"`
Args []string `json:"args,omitempty"`
Env []string `json:"env,omitempty"`
}
Hook is a lifecycle hook the spec asks the runtime to run.
type Mount ¶
type Mount struct {
HostPath string `json:"hostPath"`
ContainerPath string `json:"containerPath"`
Type string `json:"type,omitempty"`
Options []string `json:"options,omitempty"`
}
Mount is a host path to mount into the container.
type Spec ¶
type Spec struct {
Devices []Device `json:"devices"`
// ContainerEdits apply to any container the spec touches, whichever devices
// were named (driver libraries, control device nodes, env).
ContainerEdits Edits `json:"containerEdits"`
}
Spec is the part of a CDI spec that is consumed here: the devices and the edits applied to every container.