@@ -33,7 +33,6 @@ import (
3333 "sigs.k8s.io/controller-runtime/pkg/client/fake"
3434
3535 gpuv1 "github.com/NVIDIA/gpu-operator/api/nvidia/v1"
36- internalptr "github.com/NVIDIA/gpu-operator/internal/utils/ptr"
3736)
3837
3938var mockClientMap map [string ]client.Client
@@ -378,8 +377,8 @@ func TestTransformForRuntime(t *testing.T) {
378377 input : NewDaemonset ().
379378 WithContainer (corev1.Container {Name : "test-ctr" }),
380379 expectedOutput : NewDaemonset ().
381- WithHostPathVolume ("containerd-config" , filepath .Dir (DefaultContainerdConfigFile ), internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
382- WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
380+ WithHostPathVolume ("containerd-config" , filepath .Dir (DefaultContainerdConfigFile ), ptr . To (corev1 .HostPathDirectoryOrCreate )).
381+ WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
383382 WithHostPathVolume ("containerd-socket" , filepath .Dir (DefaultContainerdSocketFile ), nil ).
384383 WithContainer (corev1.Container {
385384 Name : "test-ctr" ,
@@ -411,8 +410,8 @@ func TestTransformForRuntime(t *testing.T) {
411410 },
412411 }),
413412 expectedOutput : NewDaemonset ().
414- WithHostPathVolume ("containerd-config" , filepath .Dir (DefaultContainerdConfigFile ), internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
415- WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
413+ WithHostPathVolume ("containerd-config" , filepath .Dir (DefaultContainerdConfigFile ), ptr . To (corev1 .HostPathDirectoryOrCreate )).
414+ WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
416415 WithHostPathVolume ("containerd-socket" , filepath .Dir (DefaultContainerdSocketFile ), nil ).
417416 WithContainer (corev1.Container {
418417 Name : "test-ctr" ,
@@ -445,8 +444,8 @@ func TestTransformForRuntime(t *testing.T) {
445444 },
446445 }),
447446 expectedOutput : NewDaemonset ().
448- WithHostPathVolume ("containerd-config" , filepath .Dir (DefaultContainerdConfigFile ), internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
449- WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
447+ WithHostPathVolume ("containerd-config" , filepath .Dir (DefaultContainerdConfigFile ), ptr . To (corev1 .HostPathDirectoryOrCreate )).
448+ WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
450449 WithHostPathVolume ("containerd-socket" , filepath .Dir (DefaultContainerdSocketFile ), nil ).
451450 WithContainer (corev1.Container {
452451 Name : "test-ctr" ,
@@ -473,8 +472,8 @@ func TestTransformForRuntime(t *testing.T) {
473472 runtime : gpuv1 .CRIO ,
474473 input : NewDaemonset ().WithContainer (corev1.Container {Name : "test-ctr" }),
475474 expectedOutput : NewDaemonset ().
476- WithHostPathVolume ("crio-config" , "/etc/crio" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
477- WithHostPathVolume ("crio-drop-in-config" , "/etc/crio/crio.conf.d" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
475+ WithHostPathVolume ("crio-config" , "/etc/crio" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
476+ WithHostPathVolume ("crio-drop-in-config" , "/etc/crio/crio.conf.d" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
478477 WithContainer (corev1.Container {
479478 Name : "test-ctr" ,
480479 Env : []corev1.EnvVar {
@@ -497,7 +496,7 @@ func TestTransformForRuntime(t *testing.T) {
497496 input : NewDaemonset ().
498497 WithContainer (corev1.Container {Name : "nvidia-kata-manager" }),
499498 expectedOutput : NewDaemonset ().
500- WithHostPathVolume ("containerd-config" , filepath .Dir (DefaultContainerdConfigFile ), internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
499+ WithHostPathVolume ("containerd-config" , filepath .Dir (DefaultContainerdConfigFile ), ptr . To (corev1 .HostPathDirectoryOrCreate )).
501500 WithHostPathVolume ("containerd-socket" , filepath .Dir (DefaultContainerdSocketFile ), nil ).
502501 WithContainer (corev1.Container {
503502 Name : "nvidia-kata-manager" ,
@@ -520,7 +519,7 @@ func TestTransformForRuntime(t *testing.T) {
520519 runtime : gpuv1 .Docker ,
521520 input : NewDaemonset ().WithContainer (corev1.Container {Name : "test-ctr" }),
522521 expectedOutput : NewDaemonset ().
523- WithHostPathVolume ("docker-config" , filepath .Dir (DefaultDockerConfigFile ), internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
522+ WithHostPathVolume ("docker-config" , filepath .Dir (DefaultDockerConfigFile ), ptr . To (corev1 .HostPathDirectoryOrCreate )).
524523 WithHostPathVolume ("docker-socket" , filepath .Dir (DefaultDockerSocketFile ), nil ).
525524 WithContainer (corev1.Container {
526525 Name : "test-ctr" ,
@@ -841,8 +840,8 @@ func TestTransformToolkit(t *testing.T) {
841840 {Name : "containerd-socket" , MountPath : "/runtime/sock-dir/" },
842841 },
843842 }).
844- WithHostPathVolume ("containerd-config" , "/etc/containerd" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
845- WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
843+ WithHostPathVolume ("containerd-config" , "/etc/containerd" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
844+ WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
846845 WithHostPathVolume ("containerd-socket" , "/run/containerd" , nil ).
847846 WithPullSecret ("pull-secret" ),
848847 },
@@ -920,8 +919,8 @@ func TestTransformToolkit(t *testing.T) {
920919 {Name : "containerd-socket" , MountPath : "/runtime/sock-dir/" },
921920 },
922921 }).
923- WithHostPathVolume ("containerd-config" , "/var/lib/rancher/k3s/agent/etc/containerd" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
924- WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
922+ WithHostPathVolume ("containerd-config" , "/var/lib/rancher/k3s/agent/etc/containerd" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
923+ WithHostPathVolume ("containerd-drop-in-config" , "/etc/containerd/conf.d" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
925924 WithHostPathVolume ("containerd-socket" , "/run/k3s/containerd" , nil ).
926925 WithPullSecret ("pull-secret" ),
927926 },
@@ -958,8 +957,8 @@ func TestTransformToolkit(t *testing.T) {
958957 {Name : "crio-drop-in-config" , MountPath : "/runtime/config-dir.d/" },
959958 },
960959 }).
961- WithHostPathVolume ("crio-config" , "/etc/crio" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
962- WithHostPathVolume ("crio-drop-in-config" , "/etc/crio/crio.conf.d" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )),
960+ WithHostPathVolume ("crio-config" , "/etc/crio" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
961+ WithHostPathVolume ("crio-drop-in-config" , "/etc/crio/crio.conf.d" , ptr . To (corev1 .HostPathDirectoryOrCreate )),
963962 },
964963 {
965964 description : "transform nvidia-container-toolkit-ctr container, cri-o runtime, cdi disabled" ,
@@ -994,8 +993,8 @@ func TestTransformToolkit(t *testing.T) {
994993 {Name : "crio-drop-in-config" , MountPath : "/runtime/config-dir.d/" },
995994 },
996995 }).
997- WithHostPathVolume ("crio-config" , "/etc/crio" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
998- WithHostPathVolume ("crio-drop-in-config" , "/etc/crio/crio.conf.d" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )),
996+ WithHostPathVolume ("crio-config" , "/etc/crio" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
997+ WithHostPathVolume ("crio-drop-in-config" , "/etc/crio/crio.conf.d" , ptr . To (corev1 .HostPathDirectoryOrCreate )),
999998 },
1000999 }
10011000
@@ -1121,8 +1120,8 @@ func TestTransformMPSControlDaemon(t *testing.T) {
11211120 daemonset : NewDaemonset ().
11221121 WithInitContainer (corev1.Container {Name : "mps-control-daemon-mounts" }).
11231122 WithContainer (corev1.Container {Name : "mps-control-daemon-ctr" }).
1124- WithHostPathVolume ("mps-root" , "/run/nvidia/mps" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
1125- WithHostPathVolume ("mps-shm" , "/run/nvidia/mps/shm" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )),
1123+ WithHostPathVolume ("mps-root" , "/run/nvidia/mps" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
1124+ WithHostPathVolume ("mps-shm" , "/run/nvidia/mps/shm" , ptr . To (corev1 .HostPathDirectoryOrCreate )),
11261125 clusterPolicySpec : & gpuv1.ClusterPolicySpec {
11271126 DevicePlugin : gpuv1.DevicePluginSpec {
11281127 Repository : "nvcr.io" ,
@@ -1147,8 +1146,8 @@ func TestTransformMPSControlDaemon(t *testing.T) {
11471146 {Name : "NVIDIA_MIG_MONITOR_DEVICES" , Value : "all" },
11481147 },
11491148 }).
1150- WithHostPathVolume ("mps-root" , "/var/mps" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
1151- WithHostPathVolume ("mps-shm" , "/var/mps/shm" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
1149+ WithHostPathVolume ("mps-root" , "/var/mps" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
1150+ WithHostPathVolume ("mps-shm" , "/var/mps/shm" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
11521151 WithPullSecret ("secret" ).
11531152 WithRuntimeClassName ("nvidia" ),
11541153 },
@@ -1541,7 +1540,7 @@ func TestTransformKataManager(t *testing.T) {
15411540 {Name : "containerd-config" , MountPath : "/runtime/config-dir/" },
15421541 {Name : "containerd-socket" , MountPath : "/runtime/sock-dir/" },
15431542 },
1544- }).WithPullSecret ("pull-secret" ).WithPodAnnotations (map [string ]string {"nvidia.com/kata-manager.last-applied-hash" : "1929911998" }).WithHostPathVolume ("kata-artifacts" , "/var/lib/kata" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).WithHostPathVolume ("containerd-config" , "/etc/containerd" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).WithHostPathVolume ("containerd-socket" , "/run/containerd" , nil ),
1543+ }).WithPullSecret ("pull-secret" ).WithPodAnnotations (map [string ]string {"nvidia.com/kata-manager.last-applied-hash" : "1929911998" }).WithHostPathVolume ("kata-artifacts" , "/var/lib/kata" , ptr . To (corev1 .HostPathDirectoryOrCreate )).WithHostPathVolume ("containerd-config" , "/etc/containerd" , ptr . To (corev1 .HostPathDirectoryOrCreate )).WithHostPathVolume ("containerd-socket" , "/run/containerd" , nil ),
15451544 },
15461545 {
15471546 description : "transform kata manager with custom container runtime socket" ,
@@ -1595,8 +1594,8 @@ func TestTransformKataManager(t *testing.T) {
15951594 },
15961595 }).WithPullSecret ("pull-secret" ).
15971596 WithPodAnnotations (map [string ]string {"nvidia.com/kata-manager.last-applied-hash" : "1929911998" }).
1598- WithHostPathVolume ("kata-artifacts" , "/var/lib/kata" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
1599- WithHostPathVolume ("containerd-config" , "/var/lib/rancher/k3s/agent/etc/containerd" , internalptr . HostPathType (corev1 .HostPathDirectoryOrCreate )).
1597+ WithHostPathVolume ("kata-artifacts" , "/var/lib/kata" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
1598+ WithHostPathVolume ("containerd-config" , "/var/lib/rancher/k3s/agent/etc/containerd" , ptr . To (corev1 .HostPathDirectoryOrCreate )).
16001599 WithHostPathVolume ("containerd-socket" , "/run/k3s/containerd" , nil ),
16011600 },
16021601 }
0 commit comments