engine

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SaveToSTDOUT is used to write the specified config to stdout instead of
	// to a file on disk.
	SaveToSTDOUT = ""
	// UpdateActionSet is used as an argument to UpdateDefaultRuntime
	// when setting a runtime handler as the default in the config
	UpdateActionSet = "set"
	// UpdateActionUnset is used as an argument to UpdateDefaultRuntime
	// when unsetting a runtime handler as the default in the config
	UpdateActionUnset = "unset"
)

Variables

This section is empty.

Functions

func GetBinaryPathsForRuntimes added in v1.17.0

func GetBinaryPathsForRuntimes(cfg defaultRuntimesGetter) []string

GetBinaryPathsForRuntimes returns the list of binary paths for common runtimes. The following list of runtimes is considered:

the default runtime, "runc", and "crun"

If an nvidia* runtime is set as the default runtime, this is ignored.

func GetLowLevelRuntimes added in v1.17.0

func GetLowLevelRuntimes(cfg defaultRuntimesGetter) []string

GetLowLevelRuntimes returns a predefined list low-level runtimes from the specified config. nvidia* runtimes are ignored.

Types

type Config

type Config struct {
	Source      RuntimeConfigSource
	Destination RuntimeConfigDestination
}

A Config represents a config for a container engine. These include container, cri-o, and docker. The config is logically split into a Source and Destination. This allows an existing config to be updated (Source == Destination) or runtime-specific settings to be written to a new config. The latter is useful when creation NVIDIA-specific drop-in files for container engines that support this.

func (*Config) AddRuntime added in v1.18.0

func (c *Config) AddRuntime(name string, path string, setAsDefault bool) error

AddRuntime adds a runtime to the destination config and optionally sets it as the default. The options to apply to the added runtime are read from the source config default runtime.

func (*Config) DefaultRuntime added in v1.18.0

func (c *Config) DefaultRuntime() string

DefaultRuntime returns the default runtime for the source config.

func (*Config) EnableCDI added in v1.18.0

func (c *Config) EnableCDI()

EnableCDI enables CDI in the destination config.

func (*Config) GetRuntimeConfig added in v1.18.0

func (c *Config) GetRuntimeConfig(runtime string) (RuntimeConfig, error)

GetRuntimeConfig returns the source config for the specified runtime.

func (*Config) RemoveRuntime added in v1.18.0

func (c *Config) RemoveRuntime(runtime string) error

RemoveRuntime removes a runtime from the destination config.

func (*Config) Save added in v1.18.0

func (c *Config) Save(path string) (int64, error)

Save saves the destination runtime to the specified path.

func (*Config) String added in v1.18.0

func (c *Config) String() string

func (*Config) UpdateDefaultRuntime added in v1.18.0

func (c *Config) UpdateDefaultRuntime(runtime string, action string) error

UpdateDefaultRuntime updates the default runtime setting in the destination config. When action is 'set' the provided runtime name is set as the default. When action is 'unset' we make sure the provided runtime name is not the default.

type Interface

type Interface interface {
	AddRuntime(string, string, bool) error
	DefaultRuntime() string
	EnableCDI()
	GetRuntimeConfig(string) (RuntimeConfig, error)
	RemoveRuntime(string) error
	UpdateDefaultRuntime(string, string) error
	Save(string) (int64, error)
	String() string
}

Interface defines the API for a runtime config updater.

type RuntimeConfig added in v1.17.0

type RuntimeConfig interface {
	GetBinaryPath() string
}

RuntimeConfig defines the interface to query container runtime handler configuration

type RuntimeConfigDestination added in v1.18.0

type RuntimeConfigDestination interface {
	AddRuntimeWithOptions(string, string, bool, interface{}) error
	EnableCDI()
	RemoveRuntime(string) error
	UpdateDefaultRuntime(string, string) error
	Save(string) (int64, error)
	String() string
}

A RuntimeConfigDestination allows a runtime with specific settings to be WRITTEN to a config.

type RuntimeConfigSource added in v1.18.0

type RuntimeConfigSource interface {
	DefaultRuntime() string
	GetRuntimeConfig(string) (RuntimeConfig, error)
	GetDefaultRuntimeOptions() interface{}
	String() string
}

A RuntimeConfigSource allows runtime-specific settings to be READ from a config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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