@@ -40,7 +40,7 @@ import (
4040
4141 "k8s.io/apimachinery/pkg/util/wait"
4242 "k8s.io/klog/v2"
43- "k8s.io/utils/pointer "
43+ "k8s.io/utils/ptr "
4444
4545 "sigs.k8s.io/blob-csi-driver/pkg/util"
4646 "sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient"
@@ -99,7 +99,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
9999 var vnetResourceIDs []string
100100 var err error
101101 // set allowBlobPublicAccess as false by default
102- allowBlobPublicAccess := pointer . Bool (false )
102+ allowBlobPublicAccess := ptr . To (false )
103103
104104 containerNameReplaceMap := map [string ]string {}
105105
@@ -138,7 +138,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
138138 secretNamespace = v
139139 case isHnsEnabledField :
140140 if strings .EqualFold (v , trueValue ) {
141- isHnsEnabled = pointer . Bool (true )
141+ isHnsEnabled = ptr . To (true )
142142 }
143143 case softDeleteBlobsField :
144144 days , err := parseDays (v )
@@ -153,7 +153,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
153153 }
154154 softDeleteContainers = days
155155 case enableBlobVersioningField :
156- enableBlobVersioning = pointer . Bool (strings .EqualFold (v , trueValue ))
156+ enableBlobVersioning = ptr . To (strings .EqualFold (v , trueValue ))
157157 case storeAccountKeyField :
158158 if strings .EqualFold (v , falseValue ) {
159159 storeAccountKey = false
@@ -164,17 +164,17 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
164164 }
165165 case allowBlobPublicAccessField :
166166 if strings .EqualFold (v , trueValue ) {
167- allowBlobPublicAccess = pointer . Bool (true )
167+ allowBlobPublicAccess = ptr . To (true )
168168 }
169169 case allowSharedKeyAccessField :
170170 var boolValue bool
171171 if boolValue , err = strconv .ParseBool (v ); err != nil {
172172 return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in volume context" , allowSharedKeyAccessField , v )
173173 }
174- allowSharedKeyAccess = pointer . Bool (boolValue )
174+ allowSharedKeyAccess = ptr . To (boolValue )
175175 case requireInfraEncryptionField :
176176 if strings .EqualFold (v , trueValue ) {
177- requireInfraEncryption = pointer . Bool (true )
177+ requireInfraEncryption = ptr . To (true )
178178 }
179179 case pvcNamespaceKey :
180180 pvcNamespace = v
@@ -221,8 +221,8 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
221221 }
222222 }
223223
224- if pointer . BoolDeref (enableBlobVersioning , false ) {
225- if isNFSProtocol (protocol ) || pointer . BoolDeref (isHnsEnabled , false ) {
224+ if ptr . Deref (enableBlobVersioning , false ) {
225+ if isNFSProtocol (protocol ) || ptr . Deref (isHnsEnabled , false ) {
226226 return nil , status .Errorf (codes .InvalidArgument , "enableBlobVersioning is not supported for NFS protocol or HNS enabled account" )
227227 }
228228 }
@@ -269,15 +269,15 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
269269 if strings .Contains (subnetName , "," ) {
270270 return nil , status .Errorf (codes .InvalidArgument , "subnetName(%s) can only contain one subnet for private endpoint" , subnetName )
271271 }
272- createPrivateEndpoint = pointer . BoolPtr (true )
272+ createPrivateEndpoint = ptr . To (true )
273273 }
274274 accountKind := string (armstorage .KindStorageV2 )
275275 if isNFSProtocol (protocol ) {
276- isHnsEnabled = pointer . Bool (true )
277- enableNfsV3 = pointer . Bool (true )
276+ isHnsEnabled = ptr . To (true )
277+ enableNfsV3 = ptr . To (true )
278278 // NFS protocol does not need account key
279279 storeAccountKey = false
280- if ! pointer . BoolDeref (createPrivateEndpoint , false ) {
280+ if ! ptr . Deref (createPrivateEndpoint , false ) {
281281 // set VirtualNetworkResourceIDs for storage account firewall setting
282282 var err error
283283 if vnetResourceIDs , err = d .updateSubnetServiceEndpoints (ctx , vnetResourceGroup , vnetName , subnetName ); err != nil {
@@ -305,7 +305,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
305305 storageEndpointSuffix = d .getStorageEndPointSuffix ()
306306 }
307307
308- if storeAccountKey && ! pointer . BoolDeref (allowSharedKeyAccess , true ) {
308+ if storeAccountKey && ! ptr . Deref (allowSharedKeyAccess , true ) {
309309 return nil , status .Errorf (codes .InvalidArgument , "storeAccountKey is not supported for account with shared access key disabled" )
310310 }
311311
@@ -382,7 +382,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
382382 if v , ok := d .volMap .Load (volName ); ok {
383383 accountName = v .(string )
384384 } else {
385- lockKey := fmt .Sprintf ("%s%s%s%s%s%v" , storageAccountType , accountKind , resourceGroup , location , protocol , pointer . BoolDeref (createPrivateEndpoint , false ))
385+ lockKey := fmt .Sprintf ("%s%s%s%s%s%v" , storageAccountType , accountKind , resourceGroup , location , protocol , ptr . Deref (createPrivateEndpoint , false ))
386386 // search in cache first
387387 cache , err := d .accountSearchCache .Get (lockKey , azcache .CacheReadTypeDefault )
388388 if err != nil {
@@ -411,7 +411,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
411411 }
412412 }
413413
414- if pointer . BoolDeref (createPrivateEndpoint , false ) && isNFSProtocol (protocol ) {
414+ if ptr . Deref (createPrivateEndpoint , false ) && isNFSProtocol (protocol ) {
415415 // As for blobfuse/blobfuse2, serverName, i.e.,AZURE_STORAGE_BLOB_ENDPOINT env variable can't include
416416 // "privatelink", issue: https://github.com/Azure/azure-storage-fuse/issues/1014
417417 //
0 commit comments