config

package
v1.14.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultExecutableDir specifies the default path to use for executables if they cannot be located in the path.
	DefaultExecutableDir = "/usr/bin"

	// NVIDIAContainerRuntimeHookExecutable is the executable name for the NVIDIA Container Runtime Hook
	NVIDIAContainerRuntimeHookExecutable = "nvidia-container-runtime-hook"
	// NVIDIAContainerToolkitExecutable is the executable name for the NVIDIA Container Toolkit (an alias for the NVIDIA Container Runtime Hook)
	NVIDIAContainerToolkitExecutable = "nvidia-container-toolkit"
)

Functions

func ResolveNVIDIACTKPath added in v1.14.0

func ResolveNVIDIACTKPath(logger logger.Interface, nvidiaCTKPath string) string

ResolveNVIDIACTKPath resolves the path to the nvidia-ctk binary. This executable is used in hooks and needs to be an absolute path. If the path is specified as an absolute path, it is used directly without checking for existence of an executable at that path.

func ResolveNVIDIAContainerRuntimeHookPath added in v1.13.2

func ResolveNVIDIAContainerRuntimeHookPath(logger logger.Interface, nvidiaContainerRuntimeHookPath string) string

ResolveNVIDIAContainerRuntimeHookPath resolves the path the nvidia-container-runtime-hook binary.

Types

type CTKConfig

type CTKConfig struct {
	Path string `toml:"path"`
}

CTKConfig stores the config options for the NVIDIA Container Toolkit CLI (nvidia-ctk)

type Config

type Config struct {
	DisableRequire           bool `toml:"disable-require"`
	AcceptEnvvarUnprivileged bool `toml:"accept-nvidia-visible-devices-envvar-when-unprivileged"`

	NVIDIAContainerCLIConfig         ContainerCLIConfig `toml:"nvidia-container-cli"`
	NVIDIACTKConfig                  CTKConfig          `toml:"nvidia-ctk"`
	NVIDIAContainerRuntimeConfig     RuntimeConfig      `toml:"nvidia-container-runtime"`
	NVIDIAContainerRuntimeHookConfig RuntimeHookConfig  `toml:"nvidia-container-runtime-hook"`
}

Config represents the contents of the config.toml file for the NVIDIA Container Toolkit Note: This is currently duplicated by the HookConfig in cmd/nvidia-container-toolkit/hook_config.go

func GetConfig

func GetConfig() (*Config, error)

GetConfig sets up the config struct. Values are read from a toml file or set via the environment.

func Load

func Load(configFilePath string) (*Config, error)

Load loads the config from the specified file path.

func LoadFrom

func LoadFrom(reader io.Reader) (*Config, error)

LoadFrom reads the config from the specified Reader

func (Config) Save

func (c Config) Save(w io.Writer) (int64, error)

Save writes the config to the specified writer.

type ContainerCLIConfig

type ContainerCLIConfig struct {
	Root        string   `toml:"root"`
	LoadKmods   bool     `toml:"load-kmods"`
	Ldconfig    string   `toml:"ldconfig"`
	Environment []string `toml:"environment"`
}

ContainerCLIConfig stores the options for the nvidia-container-cli

type RuntimeConfig

type RuntimeConfig struct {
	DebugFilePath string `toml:"debug"`
	// LogLevel defines the logging level for the application
	LogLevel string `toml:"log-level"`
	// Runtimes defines the candidates for the low-level runtime
	Runtimes []string    `toml:"runtimes"`
	Mode     string      `toml:"mode"`
	Modes    modesConfig `toml:"modes"`
}

RuntimeConfig stores the config options for the NVIDIA Container Runtime

func GetDefaultRuntimeConfig

func GetDefaultRuntimeConfig() (*RuntimeConfig, error)

GetDefaultRuntimeConfig defines the default values for the config

type RuntimeHookConfig added in v1.13.0

type RuntimeHookConfig struct {
	// Path specifies the path to the NVIDIA Container Runtime hook binary.
	// If an executable name is specified, this will be resolved in the path.
	Path string `toml:"path"`
	// SkipModeDetection disables the mode check for the runtime hook.
	SkipModeDetection bool `toml:"skip-mode-detection"`
}

RuntimeHookConfig stores the config options for the NVIDIA Container Runtime

func GetDefaultRuntimeHookConfig added in v1.13.0

func GetDefaultRuntimeHookConfig() (*RuntimeHookConfig, error)

GetDefaultRuntimeHookConfig defines the default values for the config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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