@@ -40,7 +40,7 @@ import (
40
40
41
41
"k8s.io/apimachinery/pkg/util/wait"
42
42
"k8s.io/klog/v2"
43
- "k8s.io/utils/pointer "
43
+ "k8s.io/utils/ptr "
44
44
45
45
"sigs.k8s.io/blob-csi-driver/pkg/util"
46
46
"sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient"
@@ -99,7 +99,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
99
99
var vnetResourceIDs []string
100
100
var err error
101
101
// set allowBlobPublicAccess as false by default
102
- allowBlobPublicAccess := pointer . Bool (false )
102
+ allowBlobPublicAccess := ptr . To (false )
103
103
104
104
containerNameReplaceMap := map [string ]string {}
105
105
@@ -138,7 +138,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
138
138
secretNamespace = v
139
139
case isHnsEnabledField :
140
140
if strings .EqualFold (v , trueValue ) {
141
- isHnsEnabled = pointer . Bool (true )
141
+ isHnsEnabled = ptr . To (true )
142
142
}
143
143
case softDeleteBlobsField :
144
144
days , err := parseDays (v )
@@ -153,7 +153,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
153
153
}
154
154
softDeleteContainers = days
155
155
case enableBlobVersioningField :
156
- enableBlobVersioning = pointer . Bool (strings .EqualFold (v , trueValue ))
156
+ enableBlobVersioning = ptr . To (strings .EqualFold (v , trueValue ))
157
157
case storeAccountKeyField :
158
158
if strings .EqualFold (v , falseValue ) {
159
159
storeAccountKey = false
@@ -164,17 +164,17 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
164
164
}
165
165
case allowBlobPublicAccessField :
166
166
if strings .EqualFold (v , trueValue ) {
167
- allowBlobPublicAccess = pointer . Bool (true )
167
+ allowBlobPublicAccess = ptr . To (true )
168
168
}
169
169
case allowSharedKeyAccessField :
170
170
var boolValue bool
171
171
if boolValue , err = strconv .ParseBool (v ); err != nil {
172
172
return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in volume context" , allowSharedKeyAccessField , v )
173
173
}
174
- allowSharedKeyAccess = pointer . Bool (boolValue )
174
+ allowSharedKeyAccess = ptr . To (boolValue )
175
175
case requireInfraEncryptionField :
176
176
if strings .EqualFold (v , trueValue ) {
177
- requireInfraEncryption = pointer . Bool (true )
177
+ requireInfraEncryption = ptr . To (true )
178
178
}
179
179
case pvcNamespaceKey :
180
180
pvcNamespace = v
@@ -221,8 +221,8 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
221
221
}
222
222
}
223
223
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 ) {
226
226
return nil , status .Errorf (codes .InvalidArgument , "enableBlobVersioning is not supported for NFS protocol or HNS enabled account" )
227
227
}
228
228
}
@@ -269,15 +269,15 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
269
269
if strings .Contains (subnetName , "," ) {
270
270
return nil , status .Errorf (codes .InvalidArgument , "subnetName(%s) can only contain one subnet for private endpoint" , subnetName )
271
271
}
272
- createPrivateEndpoint = pointer . BoolPtr (true )
272
+ createPrivateEndpoint = ptr . To (true )
273
273
}
274
274
accountKind := string (armstorage .KindStorageV2 )
275
275
if isNFSProtocol (protocol ) {
276
- isHnsEnabled = pointer . Bool (true )
277
- enableNfsV3 = pointer . Bool (true )
276
+ isHnsEnabled = ptr . To (true )
277
+ enableNfsV3 = ptr . To (true )
278
278
// NFS protocol does not need account key
279
279
storeAccountKey = false
280
- if ! pointer . BoolDeref (createPrivateEndpoint , false ) {
280
+ if ! ptr . Deref (createPrivateEndpoint , false ) {
281
281
// set VirtualNetworkResourceIDs for storage account firewall setting
282
282
var err error
283
283
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)
305
305
storageEndpointSuffix = d .getStorageEndPointSuffix ()
306
306
}
307
307
308
- if storeAccountKey && ! pointer . BoolDeref (allowSharedKeyAccess , true ) {
308
+ if storeAccountKey && ! ptr . Deref (allowSharedKeyAccess , true ) {
309
309
return nil , status .Errorf (codes .InvalidArgument , "storeAccountKey is not supported for account with shared access key disabled" )
310
310
}
311
311
@@ -382,7 +382,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
382
382
if v , ok := d .volMap .Load (volName ); ok {
383
383
accountName = v .(string )
384
384
} 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 ))
386
386
// search in cache first
387
387
cache , err := d .accountSearchCache .Get (lockKey , azcache .CacheReadTypeDefault )
388
388
if err != nil {
@@ -411,7 +411,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
411
411
}
412
412
}
413
413
414
- if pointer . BoolDeref (createPrivateEndpoint , false ) && isNFSProtocol (protocol ) {
414
+ if ptr . Deref (createPrivateEndpoint , false ) && isNFSProtocol (protocol ) {
415
415
// As for blobfuse/blobfuse2, serverName, i.e.,AZURE_STORAGE_BLOB_ENDPOINT env variable can't include
416
416
// "privatelink", issue: https://github.com/Azure/azure-storage-fuse/issues/1014
417
417
//
0 commit comments