Documentation ¶
Index ¶
- Variables
- func GetConfigFilePath() string
- func NormalizeLDConfigPath(path string) string
- func ResolveNVIDIACDIHookPath(logger logger.Interface, nvidiaCDIHookPath string) string
- func ResolveNVIDIACTKPath(logger logger.Interface, nvidiaCTKPath string) stringdeprecated
- func ResolveNVIDIAContainerRuntimeHookPath(logger logger.Interface, nvidiaContainerRuntimeHookPath string) string
- type CTKConfig
- type Config
- type ContainerCLIConfig
- type Option
- type RuntimeConfig
- type RuntimeHookConfig
- type Toml
- func (t *Toml) Config() (*Config, error)
- func (t *Toml) Delete(key string) error
- func (t *Toml) Get(key string) interface{}
- func (t *Toml) GetDefault(key string, def interface{}) interface{}
- func (t *Toml) Save(w io.Writer) (int64, error)
- func (t *Toml) Set(key string, value interface{})
- func (t *Toml) Unmarshal(v interface{}) error
- func (t *Toml) WriteTo(w io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
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 GetConfigFilePath ¶ added in v1.14.0
func GetConfigFilePath() string
GetConfigFilePath returns the path to the config file for the configured system
func NormalizeLDConfigPath ¶ added in v1.15.0
NormalizeLDConfigPath returns the resolved path of the configured LDConfig binary. This is only done for host LDConfigs and is required to handle systems where /sbin/ldconfig is a wrapper around /sbin/ldconfig.real.
func ResolveNVIDIACDIHookPath ¶ added in v1.16.0
ResolveNVIDIACDIHookPath resolves the path to the nvidia-cdi-hook 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 ResolveNVIDIACTKPath
deprecated
added in
v1.14.0
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.
Deprecated: Use ResolveNVIDIACDIHookPath directly instead.
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"` SwarmResource string `toml:"swarm-resource"` AcceptEnvvarUnprivileged bool `toml:"accept-nvidia-visible-devices-envvar-when-unprivileged"` AcceptDeviceListAsVolumeMounts bool `toml:"accept-nvidia-visible-devices-as-volume-mounts"` SupportedDriverCapabilities string `toml:"supported-driver-capabilities"` NVIDIAContainerCLIConfig ContainerCLIConfig `toml:"nvidia-container-cli"` NVIDIACTKConfig CTKConfig `toml:"nvidia-ctk"` NVIDIAContainerRuntimeConfig RuntimeConfig `toml:"nvidia-container-runtime"` NVIDIAContainerRuntimeHookConfig RuntimeHookConfig `toml:"nvidia-container-runtime-hook"` // Features allows for finer control over optional features. Features features `toml:"features,omitempty"` }
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 ¶
GetConfig sets up the config struct. Values are read from a toml file or set via the environment.
func GetDefault ¶ added in v1.14.0
GetDefault defines the default values for the config
type ContainerCLIConfig ¶
type ContainerCLIConfig struct { Root string `toml:"root"` Path string `toml:"path"` Environment []string `toml:"environment"` Debug string `toml:"debug"` Ldcache string `toml:"ldcache"` LoadKmods bool `toml:"load-kmods"` // NoPivot disables the pivot root operation in the NVIDIA Container CLI. // This is not exposed in the config if not set. NoPivot bool `toml:"no-pivot,omitempty"` NoCgroups bool `toml:"no-cgroups"` User string `toml:"user"` Ldconfig string `toml:"ldconfig"` }
ContainerCLIConfig stores the options for the nvidia-container-cli
func (*ContainerCLIConfig) NormalizeLDConfigPath ¶ added in v1.15.0
func (c *ContainerCLIConfig) NormalizeLDConfigPath() string
NormalizeLDConfigPath returns the resolved path of the configured LDConfig binary. This is only done for host LDConfigs and is required to handle systems where /sbin/ldconfig is a wrapper around /sbin/ldconfig.real.
type Option ¶ added in v1.14.0
type Option func(*options)
Option is a functional option for loading TOML config files.
func WithConfigFile ¶ added in v1.14.0
WithConfigFile sets the config file option.
func WithRequired ¶ added in v1.14.1
WithRequired sets the required option. If this is set to true, a failure to open the specified file is treated as an error
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
type Toml ¶ added in v1.14.0
type Toml toml.Tree
Toml is a type for the TOML representation of a config.
func (*Toml) Config ¶ added in v1.14.0
Config returns the typed config associated with the toml tree.
func (*Toml) GetDefault ¶ added in v1.17.0
GetDefault returns the value for the specified key and falls back to the default value if the Get call fails
func (*Toml) Set ¶ added in v1.14.0
Set sets the specified key to the specified value in the TOML config.