@@ -891,6 +891,44 @@ func TestTransformDevicePlugin(t *testing.T) {
891891 },
892892 }).WithContainer (corev1.Container {Name : "dummy" }).WithPullSecret ("pull-secret" ).WithRuntimeClassName ("nvidia" ),
893893 },
894+ {
895+ description : "transform device plugin, gds and gdrcopy enabled" ,
896+ ds : NewDaemonset ().
897+ WithContainer (corev1.Container {Name : "nvidia-device-plugin" }),
898+ cpSpec : & gpuv1.ClusterPolicySpec {
899+ DevicePlugin : gpuv1.DevicePluginSpec {
900+ Repository : "nvcr.io/nvidia/cloud-native" ,
901+ Image : "nvidia-device-plugin" ,
902+ Version : "v1.0.0" ,
903+ ImagePullPolicy : "IfNotPresent" ,
904+ },
905+ Toolkit : gpuv1.ToolkitSpec {
906+ Enabled : newBoolPtr (true ),
907+ InstallDir : "/path/to/install" ,
908+ },
909+ GDRCopy : & gpuv1.GDRCopySpec {
910+ Enabled : newBoolPtr (true ),
911+ },
912+ GPUDirectStorage : & gpuv1.GPUDirectStorageSpec {
913+ Enabled : newBoolPtr (true ),
914+ },
915+ },
916+ expectedDs : NewDaemonset ().WithContainer (corev1.Container {
917+ Name : "nvidia-device-plugin" ,
918+ Image : "nvcr.io/nvidia/cloud-native/nvidia-device-plugin:v1.0.0" ,
919+ ImagePullPolicy : corev1 .PullIfNotPresent ,
920+ Env : []corev1.EnvVar {
921+ {Name : GDSEnabledEnvName , Value : "true" },
922+ {Name : MOFEDEnabledEnvName , Value : "true" },
923+ {Name : GDRCopyEnabledEnvName , Value : "true" },
924+ {Name : "NVIDIA_MIG_MONITOR_DEVICES" , Value : "all" },
925+ {Name : CDIEnabledEnvName , Value : "true" },
926+ {Name : DeviceListStrategyEnvName , Value : "cdi-annotations,cdi-cri" },
927+ {Name : CDIAnnotationPrefixEnvName , Value : "cdi.k8s.io/" },
928+ {Name : NvidiaCDIHookPathEnvName , Value : "/path/to/install/toolkit/nvidia-cdi-hook" },
929+ },
930+ }).WithRuntimeClassName ("nvidia" ),
931+ },
894932 }
895933
896934 for _ , tc := range testCases {
0 commit comments