From be0cc9dc6ec70a4ce8f29ce3c18335de898e94f0 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 28 Mar 2023 17:39:17 +0200 Subject: [PATCH] Add nvidia-container-runtime.runtimes config option This change adds an nvidia-container-runtime.runtimes config option. If this is unset no changes are made to the config and the default values are used. This allows this setting to be overridden in cases where this is required. One such example is crio where crun is set as the default runtime. Signed-off-by: Evan Lezar --- tools/container/toolkit/toolkit.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/container/toolkit/toolkit.go b/tools/container/toolkit/toolkit.go index b93529ee..1fdd3cd8 100644 --- a/tools/container/toolkit/toolkit.go +++ b/tools/container/toolkit/toolkit.go @@ -53,6 +53,8 @@ type options struct { ContainerRuntimeModesCdiDefaultKind string ContainerRuntimeModesCDIAnnotationPrefixes cli.StringSlice + ContainerRuntimeRuntimes cli.StringSlice + ContainerRuntimeHookSkipModeDetection bool ContainerCLIDebug string @@ -152,6 +154,11 @@ func main() { Destination: &opts.ContainerRuntimeModesCDIAnnotationPrefixes, EnvVars: []string{"NVIDIA_CONTAINER_RUNTIME_MODES_CDI_ANNOTATION_PREFIXES"}, }, + &cli.StringSliceFlag{ + Name: "nvidia-container-runtime.runtimes", + Destination: &opts.ContainerRuntimeRuntimes, + EnvVars: []string{"NVIDIA_CONTAINER_RUNTIME_RUNTIMES"}, + }, &cli.BoolFlag{ Name: "nvidia-container-runtime-hook.skip-mode-detection", Value: true, @@ -415,6 +422,7 @@ func installToolkitConfig(c *cli.Context, toolkitConfigPath string, nvidiaContai "nvidia-container-runtime.mode": opts.ContainerRuntimeMode, "nvidia-container-runtime.modes.cdi.annotation-prefixes": opts.ContainerRuntimeModesCDIAnnotationPrefixes, "nvidia-container-runtime.modes.cdi.default-kind": opts.ContainerRuntimeModesCdiDefaultKind, + "nvidia-container-runtime.runtimes": opts.ContainerRuntimeRuntimes, "nvidia-container-cli.debug": opts.ContainerCLIDebug, } for key, value := range optionalConfigValues {