@@ -1314,14 +1314,19 @@ func TransformToolkit(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, n
13141314 }
13151315 }
13161316
1317- if len (config .Toolkit .Env ) > 0 {
1318- for _ , env := range config .Toolkit .Env {
1319- setContainerEnv (toolkitMainContainer , env .Name , env .Value )
1317+ // configure runtime
1318+ runtime := n .runtime .String ()
1319+ // Update the main container environment from the user-specified values.
1320+ for _ , env := range config .Toolkit .Env {
1321+ if env .Name == "RUNTIME" {
1322+ // If the user has specified the runtime, we overide the detected
1323+ // value.
1324+ // TODO: Add logging.
1325+ runtime = env .Value
13201326 }
1327+ setContainerEnv (toolkitMainContainer , env .Name , env .Value )
13211328 }
13221329
1323- // configure runtime
1324- runtime := n .runtime .String ()
13251330 err = transformForRuntime (obj , config , runtime , toolkitMainContainer )
13261331 if err != nil {
13271332 return fmt .Errorf ("error transforming toolkit daemonset : %w" , err )
@@ -1332,6 +1337,11 @@ func TransformToolkit(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, n
13321337
13331338func transformForRuntime (obj * appsv1.DaemonSet , config * gpuv1.ClusterPolicySpec , runtime string , container * corev1.Container ) error {
13341339 setContainerEnv (container , "RUNTIME" , runtime )
1340+ // If the user has explicitly requested 'none' as a runtime, we make no
1341+ // additional changes to the container.
1342+ if runtime == "none" {
1343+ return nil
1344+ }
13351345
13361346 if runtime == gpuv1 .Containerd .String () {
13371347 // Set the runtime class name that is to be configured for containerd
0 commit comments