mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
Add new config options to pull device list from mounted files not ENVVAR
Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
b9ef2db205
commit
da36874e91
@ -1,5 +1,7 @@
|
|||||||
disable-require = false
|
disable-require = false
|
||||||
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
||||||
|
#accept-nvidia-visible-devices-envvar-when-unprivileged = true
|
||||||
|
#look-for-nvidia-visible-devices-as-volume-mounts-under = "/var/run/nvidia-container-devices"
|
||||||
|
|
||||||
[nvidia-container-cli]
|
[nvidia-container-cli]
|
||||||
#root = "/run/nvidia/driver"
|
#root = "/run/nvidia/driver"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
disable-require = false
|
disable-require = false
|
||||||
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
||||||
|
#accept-nvidia-visible-devices-envvar-when-unprivileged = true
|
||||||
|
#look-for-nvidia-visible-devices-as-volume-mounts-under = "/var/run/nvidia-container-devices"
|
||||||
|
|
||||||
[nvidia-container-cli]
|
[nvidia-container-cli]
|
||||||
#root = "/run/nvidia/driver"
|
#root = "/run/nvidia/driver"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
disable-require = false
|
disable-require = false
|
||||||
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
||||||
|
#accept-nvidia-visible-devices-envvar-when-unprivileged = true
|
||||||
|
#look-for-nvidia-visible-devices-as-volume-mounts-under = "/var/run/nvidia-container-devices"
|
||||||
|
|
||||||
[nvidia-container-cli]
|
[nvidia-container-cli]
|
||||||
#root = "/run/nvidia/driver"
|
#root = "/run/nvidia/driver"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
disable-require = false
|
disable-require = false
|
||||||
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
||||||
|
#accept-nvidia-visible-devices-envvar-when-unprivileged = true
|
||||||
|
#look-for-nvidia-visible-devices-as-volume-mounts-under = "/var/run/nvidia-container-devices"
|
||||||
|
|
||||||
[nvidia-container-cli]
|
[nvidia-container-cli]
|
||||||
#root = "/run/nvidia/driver"
|
#root = "/run/nvidia/driver"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
disable-require = false
|
disable-require = false
|
||||||
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
#swarm-resource = "DOCKER_RESOURCE_GPU"
|
||||||
|
#accept-nvidia-visible-devices-envvar-when-unprivileged = true
|
||||||
|
#look-for-nvidia-visible-devices-as-volume-mounts-under = "/var/run/nvidia-container-devices"
|
||||||
|
|
||||||
[nvidia-container-cli]
|
[nvidia-container-cli]
|
||||||
#root = "/run/nvidia/driver"
|
#root = "/run/nvidia/driver"
|
||||||
|
@ -13,6 +13,10 @@ const (
|
|||||||
driverPath = "/run/nvidia/driver"
|
driverPath = "/run/nvidia/driver"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultDeviceListVolumeMount = "/var/run/nvidia-container-devices"
|
||||||
|
)
|
||||||
|
|
||||||
var defaultPaths = [...]string{
|
var defaultPaths = [...]string{
|
||||||
path.Join(driverPath, configPath),
|
path.Join(driverPath, configPath),
|
||||||
configPath,
|
configPath,
|
||||||
@ -34,16 +38,20 @@ type CLIConfig struct {
|
|||||||
|
|
||||||
// HookConfig : options for the nvidia-container-toolkit.
|
// HookConfig : options for the nvidia-container-toolkit.
|
||||||
type HookConfig struct {
|
type HookConfig struct {
|
||||||
DisableRequire bool `toml:"disable-require"`
|
DisableRequire bool `toml:"disable-require"`
|
||||||
SwarmResource *string `toml:"swarm-resource"`
|
SwarmResource *string `toml:"swarm-resource"`
|
||||||
|
AcceptEnvvarUnprivileged bool `toml:"accept-nvidia-visible-devices-envvar-when-unprivileged"`
|
||||||
|
DeviceListVolumeMount *string `toml:"look-for-nvidia-visible-devices-as-volume-mounts-under"`
|
||||||
|
|
||||||
NvidiaContainerCLI CLIConfig `toml:"nvidia-container-cli"`
|
NvidiaContainerCLI CLIConfig `toml:"nvidia-container-cli"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDefaultHookConfig() (config HookConfig) {
|
func getDefaultHookConfig() (config HookConfig) {
|
||||||
return HookConfig{
|
return HookConfig{
|
||||||
DisableRequire: false,
|
DisableRequire: false,
|
||||||
SwarmResource: nil,
|
SwarmResource: nil,
|
||||||
|
AcceptEnvvarUnprivileged: true,
|
||||||
|
DeviceListVolumeMount: &[]string{defaultDeviceListVolumeMount}[0],
|
||||||
NvidiaContainerCLI: CLIConfig{
|
NvidiaContainerCLI: CLIConfig{
|
||||||
Root: nil,
|
Root: nil,
|
||||||
Path: nil,
|
Path: nil,
|
||||||
|
Loading…
Reference in New Issue
Block a user