specs

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentVersion = "0.4.0"

CurrentVersion is the current version of the Spec.

Variables

This section is empty.

Functions

func ApplyEditsToOCISpec

func ApplyEditsToOCISpec(config *spec.Spec, edits *ContainerEdits) error

ApplyEditsToOCISpec applies the specified edits to the OCI spec.

func ApplyOCIEdits

func ApplyOCIEdits(config *spec.Spec, cdi *Spec) error

ApplyOCIEdits applies the OCI edits the CDI spec declares globablly

func ApplyOCIEditsForDevice

func ApplyOCIEditsForDevice(config *spec.Spec, cdi *Spec, dev string) error

ApplyOCIEditsForDevice applies devices OCI edits, in other words it finds the device in the CDI spec and applies the OCI patches that device requires to the OCI specification.

Types

type ContainerEdits

type ContainerEdits struct {
	Env         []string      `json:"env,omitempty"`
	DeviceNodes []*DeviceNode `json:"deviceNodes,omitempty"`
	Hooks       []*Hook       `json:"hooks,omitempty"`
	Mounts      []*Mount      `json:"mounts,omitempty"`
}

ContainerEdits are edits a container runtime must make to the OCI spec to expose the device.

type Device

type Device struct {
	Name           string         `json:"name"`
	ContainerEdits ContainerEdits `json:"containerEdits"`
}

Device is a "Device" a container runtime can add to a container

type DeviceNode

type DeviceNode struct {
	Path        string       `json:"path"`
	Type        string       `json:"type,omitempty"`
	Major       int64        `json:"major,omitempty"`
	Minor       int64        `json:"minor,omitempty"`
	FileMode    *os.FileMode `json:"fileMode,omitempty"`
	Permissions string       `json:"permissions,omitempty"`
	UID         *uint32      `json:"uid,omitempty"`
	GID         *uint32      `json:"gid,omitempty"`
}

DeviceNode represents a device node that needs to be added to the OCI spec.

func (*DeviceNode) ToOCI

func (d *DeviceNode) ToOCI() spec.LinuxDevice

ToOCI returns the opencontainers runtime Spec LinuxDevice for this DeviceNode.

type Hook

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

Hook represents a hook that needs to be added to the OCI spec.

func (*Hook) ToOCI

func (h *Hook) ToOCI() spec.Hook

ToOCI returns the opencontainers runtime Spec Hook for this Hook.

type Mount

type Mount struct {
	HostPath      string   `json:"hostPath"`
	ContainerPath string   `json:"containerPath"`
	Options       []string `json:"options,omitempty"`
	Type          string   `json:"type,omitempty"`
}

Mount represents a mount that needs to be added to the OCI spec.

func (*Mount) ToOCI

func (m *Mount) ToOCI() spec.Mount

ToOCI returns the opencontainers runtime Spec Mount for this Mount.

type Spec

type Spec struct {
	Version string `json:"cdiVersion"`
	Kind    string `json:"kind"`

	Devices        []Device       `json:"devices"`
	ContainerEdits ContainerEdits `json:"containerEdits,omitempty"`
}

Spec is the base configuration for CDI

Jump to

Keyboard shortcuts

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