@@ -27,6 +27,7 @@ import (
2727 "github.com/NVIDIA/gpu-operator/api/nvidia/v1alpha1"
2828 "github.com/NVIDIA/gpu-operator/controllers/clusterinfo"
2929 "github.com/NVIDIA/gpu-operator/internal/consts"
30+ "github.com/NVIDIA/gpu-operator/internal/utils"
3031)
3132
3233// RepoConfigPathMap indicates standard OS specific paths for repository configuration files
@@ -60,79 +61,72 @@ var SubscriptionPathMap = map[string]MountPathToVolumeSource{
6061 "/run/secrets/etc-pki-entitlement" : corev1.VolumeSource {
6162 HostPath : & corev1.HostPathVolumeSource {
6263 Path : "/etc/pki/entitlement" ,
63- Type : newHostPathType (corev1 .HostPathDirectory ),
64+ Type : utils . HostPathTypePtr (corev1 .HostPathDirectory ),
6465 },
6566 },
6667 "/run/secrets/redhat.repo" : corev1.VolumeSource {
6768 HostPath : & corev1.HostPathVolumeSource {
6869 Path : "/etc/yum.repos.d/redhat.repo" ,
69- Type : newHostPathType (corev1 .HostPathFile ),
70+ Type : utils . HostPathTypePtr (corev1 .HostPathFile ),
7071 },
7172 },
7273 "/run/secrets/rhsm" : corev1.VolumeSource {
7374 HostPath : & corev1.HostPathVolumeSource {
7475 Path : "/etc/rhsm" ,
75- Type : newHostPathType (corev1 .HostPathDirectory ),
76+ Type : utils . HostPathTypePtr (corev1 .HostPathDirectory ),
7677 },
7778 },
7879 },
7980 "rhcos" : {
8081 "/run/secrets/etc-pki-entitlement" : corev1.VolumeSource {
8182 HostPath : & corev1.HostPathVolumeSource {
8283 Path : "/etc/pki/entitlement" ,
83- Type : newHostPathType (corev1 .HostPathDirectory ),
84+ Type : utils . HostPathTypePtr (corev1 .HostPathDirectory ),
8485 },
8586 },
8687 "/run/secrets/redhat.repo" : corev1.VolumeSource {
8788 HostPath : & corev1.HostPathVolumeSource {
8889 Path : "/etc/yum.repos.d/redhat.repo" ,
89- Type : newHostPathType (corev1 .HostPathFile ),
90+ Type : utils . HostPathTypePtr (corev1 .HostPathFile ),
9091 },
9192 },
9293 "/run/secrets/rhsm" : corev1.VolumeSource {
9394 HostPath : & corev1.HostPathVolumeSource {
9495 Path : "/etc/rhsm" ,
95- Type : newHostPathType (corev1 .HostPathDirectory ),
96+ Type : utils . HostPathTypePtr (corev1 .HostPathDirectory ),
9697 },
9798 },
9899 },
99100 "sles" : {
100101 "/etc/zypp/credentials.d" : corev1.VolumeSource {
101102 HostPath : & corev1.HostPathVolumeSource {
102103 Path : "/etc/zypp/credentials.d" ,
103- Type : newHostPathType (corev1 .HostPathDirectory ),
104+ Type : utils . HostPathTypePtr (corev1 .HostPathDirectory ),
104105 },
105106 },
106107 "/etc/SUSEConnect" : corev1.VolumeSource {
107108 HostPath : & corev1.HostPathVolumeSource {
108109 Path : "/etc/SUSEConnect" ,
109- Type : newHostPathType (corev1 .HostPathFileOrCreate ),
110+ Type : utils . HostPathTypePtr (corev1 .HostPathFileOrCreate ),
110111 },
111112 },
112113 },
113114 "sl-micro" : {
114115 "/etc/zypp/credentials.d" : corev1.VolumeSource {
115116 HostPath : & corev1.HostPathVolumeSource {
116117 Path : "/etc/zypp/credentials.d" ,
117- Type : newHostPathType (corev1 .HostPathDirectory ),
118+ Type : utils . HostPathTypePtr (corev1 .HostPathDirectory ),
118119 },
119120 },
120121 "/etc/SUSEConnect" : corev1.VolumeSource {
121122 HostPath : & corev1.HostPathVolumeSource {
122123 Path : "/etc/SUSEConnect" ,
123- Type : newHostPathType (corev1 .HostPathFileOrCreate ),
124+ Type : utils . HostPathTypePtr (corev1 .HostPathFileOrCreate ),
124125 },
125126 },
126127 },
127128}
128129
129- // TODO: make this a public utils method
130- func newHostPathType (pathType corev1.HostPathType ) * corev1.HostPathType {
131- hostPathType := new (corev1.HostPathType )
132- * hostPathType = pathType
133- return hostPathType
134- }
135-
136130func (s * stateDriver ) getDriverAdditionalConfigs (ctx context.Context , cr * v1alpha1.NVIDIADriver , info clusterinfo.Interface , pool nodePool ) (* additionalConfigs , error ) {
137131 logger := log .FromContext (ctx , "method" , "getDriverAdditionalConfigs" )
138132
0 commit comments