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

Function transformDevicePluginCtrForCDI

controllers/object_controls.go:1509–1517  ·  view source on GitHub ↗
(container *corev1.Container, config *gpuv1.ClusterPolicySpec)

Source from the content-addressed store, hash-verified

1507}
1508
1509func transformDevicePluginCtrForCDI(container *corev1.Container, config *gpuv1.ClusterPolicySpec) {
1510 setContainerEnv(container, CDIEnabledEnvName, "true")
1511 setContainerEnv(container, DeviceListStrategyEnvName, "cdi-annotations,cdi-cri")
1512 setContainerEnv(container, CDIAnnotationPrefixEnvName, "cdi.k8s.io/")
1513
1514 if config.Toolkit.IsEnabled() {
1515 setContainerEnv(container, NvidiaCDIHookPathEnvName, filepath.Join(config.Toolkit.InstallDir, "toolkit/nvidia-cdi-hook"))
1516 }
1517}
1518
1519// TransformDevicePlugin transforms k8s-device-plugin daemonset with required config as per ClusterPolicy
1520func TransformDevicePlugin(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, n ClusterPolicyController) error {

Callers 2

TransformDevicePluginFunction · 0.85

Calls 2

setContainerEnvFunction · 0.85
IsEnabledMethod · 0.45

Tested by 1