Allow nvidia-container-runtime.modes.cdi.default-kind to be set

This change allows the nvidia-container-runtime.modes.cdi.default-kind
to be set in the toolkit-container.

The NVIDIA_CONTAINER_RUNTIME_MODES_CDI_DEFAULT_KIND envvar is used.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-03-07 16:17:49 +02:00
parent 6d220ed9a2
commit 1e6fe40c76

View File

@ -43,13 +43,16 @@ const (
) )
type options struct { type options struct {
DriverRoot string DriverRoot string
DriverRootCtrPath string DriverRootCtrPath string
ContainerRuntimeMode string
ContainerRuntimeDebug string ContainerRuntimeMode string
ContainerRuntimeLogLevel string ContainerRuntimeModesCdiDefaultKind string
ContainerCLIDebug string ContainerRuntimeDebug string
toolkitRoot string ContainerRuntimeLogLevel string
ContainerCLIDebug string
toolkitRoot string
cdiOutputDir string cdiOutputDir string
cdiKind string cdiKind string
@ -129,6 +132,11 @@ func main() {
Destination: &opts.ContainerRuntimeMode, Destination: &opts.ContainerRuntimeMode,
EnvVars: []string{"NVIDIA_CONTAINER_RUNTIME_MODE"}, EnvVars: []string{"NVIDIA_CONTAINER_RUNTIME_MODE"},
}, },
&cli.StringFlag{
Name: "nvidia-container-runtime-modes.cdi.default-kind",
Destination: &opts.ContainerRuntimeModesCdiDefaultKind,
EnvVars: []string{"NVIDIA_CONTAINER_RUNTIME_MODES_CDI_DEFAULT_KIND"},
},
&cli.StringFlag{ &cli.StringFlag{
Name: "nvidia-container-cli-debug", Name: "nvidia-container-cli-debug",
Usage: "Specify the location of the debug log file for the NVIDIA Container CLI", Usage: "Specify the location of the debug log file for the NVIDIA Container CLI",
@ -345,10 +353,11 @@ func installToolkitConfig(toolkitConfigPath string, nvidiaContainerCliExecutable
// Set the debug options if selected // Set the debug options if selected
debugOptions := map[string]string{ debugOptions := map[string]string{
"nvidia-container-runtime.debug": opts.ContainerRuntimeDebug, "nvidia-container-runtime.debug": opts.ContainerRuntimeDebug,
"nvidia-container-runtime.log-level": opts.ContainerRuntimeLogLevel, "nvidia-container-runtime.log-level": opts.ContainerRuntimeLogLevel,
"nvidia-container-runtime.mode": opts.ContainerRuntimeMode, "nvidia-container-runtime.mode": opts.ContainerRuntimeMode,
"nvidia-container-cli.debug": opts.ContainerCLIDebug, "nvidia-container-runtime.modes.cdi.default-kind": opts.ContainerRuntimeModesCdiDefaultKind,
"nvidia-container-cli.debug": opts.ContainerCLIDebug,
} }
for key, value := range debugOptions { for key, value := range debugOptions {
if value == "" { if value == "" {