From cc7a6f166ba756fc4b91e4cd6695b6ba52da21bd Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 7 Mar 2023 20:59:22 +0200 Subject: [PATCH] Handle case were runtime name is set to predefined name Signed-off-by: Evan Lezar --- tools/container/operator/operator.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/container/operator/operator.go b/tools/container/operator/operator.go index fe90f715..07cb5ad4 100644 --- a/tools/container/operator/operator.go +++ b/tools/container/operator/operator.go @@ -84,8 +84,13 @@ func (r *Runtimes) add(runtime Runtime) { // nvidiaRuntime creates a runtime that corresponds to the nvidia runtime. // If the nvidiaRuntimeName is specified, this name us used unless this is exactly equal to nvidia-experimental. func (c config) nvidiaRuntime() Runtime { + predefinedRuntimes := map[string]struct{}{ + "nvidia-experimental": {}, + "nvidia-cdi": {}, + "nvidia-legacy": {}, + } name := c.nvidiaRuntimeName - if name == experimentalRuntimeName { + if _, isPredefinedRuntime := predefinedRuntimes[name]; isPredefinedRuntime { name = defaultRuntimeName } return c.newRuntime(name, "nvidia-container-runtime")