MCPcopy Create free account
hub / github.com/NVIDIA/gpu-operator / transformToolkitCtrForCDI

Function transformToolkitCtrForCDI

controllers/object_controls.go:1256–1274  ·  view source on GitHub ↗
(container *corev1.Container, nriPluginEnabled bool)

Source from the content-addressed store, hash-verified

1254}
1255
1256func transformToolkitCtrForCDI(container *corev1.Container, nriPluginEnabled bool) {
1257 // When CDI is enabled in GPU Operator, we leverage native CDI support in containerd / cri-o
1258 // to inject GPUs into workloads. We do not configure 'nvidia' as the default runtime. The
1259 // 'nvidia' runtime will be set as the runtime class for our management containers so that
1260 // they get access to all GPUs.
1261 //
1262 // Note: one could override this and continue to configure 'nvidia' as the default runtime
1263 // by directly setting the 'NVIDIA_RUNTIME_SET_AS_DEFAULT' environment variable to 'true' in
1264 // the toolkit container. One can leverage the 'toolkit.env' field in ClusterPolicy to
1265 // directly configure environment variables for the toolkit container.
1266 setContainerEnv(container, CDIEnabledEnvName, "true")
1267 setContainerEnv(container, NvidiaRuntimeSetAsDefaultEnvName, "false")
1268 setContainerEnv(container, NvidiaCtrRuntimeModeEnvName, "cdi")
1269 setContainerEnv(container, CRIOConfigModeEnvName, "config")
1270
1271 if nriPluginEnabled {
1272 setContainerEnv(container, CDIEnableNRIPlugin, "true")
1273 }
1274}
1275
1276// TransformToolkit transforms Nvidia container-toolkit daemonset with required config as per ClusterPolicy
1277func TransformToolkit(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, n ClusterPolicyController) error {

Callers 2

TransformToolkitFunction · 0.85

Calls 1

setContainerEnvFunction · 0.85

Tested by 1