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:
Kevin Klues 2020-07-22 14:42:29 +00:00
parent b9ef2db205
commit da36874e91
6 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,7 @@
disable-require = false
#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]
#root = "/run/nvidia/driver"

View File

@ -1,5 +1,7 @@
disable-require = false
#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]
#root = "/run/nvidia/driver"

View File

@ -1,5 +1,7 @@
disable-require = false
#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]
#root = "/run/nvidia/driver"

View File

@ -1,5 +1,7 @@
disable-require = false
#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]
#root = "/run/nvidia/driver"

View File

@ -1,5 +1,7 @@
disable-require = false
#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]
#root = "/run/nvidia/driver"

View File

@ -13,6 +13,10 @@ const (
driverPath = "/run/nvidia/driver"
)
const (
defaultDeviceListVolumeMount = "/var/run/nvidia-container-devices"
)
var defaultPaths = [...]string{
path.Join(driverPath, configPath),
configPath,
@ -36,6 +40,8 @@ type CLIConfig struct {
type HookConfig struct {
DisableRequire bool `toml:"disable-require"`
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"`
}
@ -44,6 +50,8 @@ func getDefaultHookConfig() (config HookConfig) {
return HookConfig{
DisableRequire: false,
SwarmResource: nil,
AcceptEnvvarUnprivileged: true,
DeviceListVolumeMount: &[]string{defaultDeviceListVolumeMount}[0],
NvidiaContainerCLI: CLIConfig{
Root: nil,
Path: nil,