Skip to content

Commit d2d4d81

Browse files
committed
fix: match account if PrivateEndpoint is not set in storage class
1 parent bffbc87 commit d2d4d81

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

pkg/blob/controllerserver.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
7373
parameters = make(map[string]string)
7474
}
7575
var storageAccountType, subsID, resourceGroup, location, account, containerName, containerNamePrefix, protocol, customTags, secretName, secretNamespace, pvcNamespace string
76-
var isHnsEnabled, requireInfraEncryption, enableBlobVersioning *bool
76+
var isHnsEnabled, requireInfraEncryption, enableBlobVersioning, createPrivateEndpoint, enableNfsV3 *bool
7777
var vnetResourceGroup, vnetName, subnetName, accessTier, networkEndpointType, storageEndpointSuffix string
7878
var matchTags, useDataPlaneAPI, getLatestAccountKey bool
7979
var softDeleteBlobs, softDeleteContainers int32
80+
var vnetResourceIDs []string
8081
var err error
8182
// set allowBlobPublicAccess as false by default
8283
allowBlobPublicAccess := pointer.Bool(false)
@@ -240,21 +241,16 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
240241
}
241242

242243
enableHTTPSTrafficOnly := true
243-
createPrivateEndpoint := false
244244
if strings.EqualFold(networkEndpointType, privateEndpoint) {
245-
createPrivateEndpoint = true
245+
createPrivateEndpoint = pointer.BoolPtr(true)
246246
}
247247
accountKind := string(storage.KindStorageV2)
248-
var (
249-
vnetResourceIDs []string
250-
enableNfsV3 *bool
251-
)
252248
if protocol == NFS {
253249
isHnsEnabled = pointer.Bool(true)
254250
enableNfsV3 = pointer.Bool(true)
255251
// NFS protocol does not need account key
256252
storeAccountKey = false
257-
if !createPrivateEndpoint {
253+
if !pointer.BoolDeref(createPrivateEndpoint, false) {
258254
// set VirtualNetworkResourceIDs for storage account firewall setting
259255
vnetResourceID := d.getSubnetResourceID(vnetResourceGroup, vnetName, subnetName)
260256
klog.V(2).Infof("set vnetResourceID(%s) for NFS protocol", vnetResourceID)
@@ -323,7 +319,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
323319
if v, ok := d.volMap.Load(volName); ok {
324320
accountName = v.(string)
325321
} else {
326-
lockKey := fmt.Sprintf("%s%s%s%s%s%v", storageAccountType, accountKind, resourceGroup, location, protocol, createPrivateEndpoint)
322+
lockKey := fmt.Sprintf("%s%s%s%s%s%v", storageAccountType, accountKind, resourceGroup, location, protocol, pointer.BoolDeref(createPrivateEndpoint, false))
327323
// search in cache first
328324
cache, err := d.accountSearchCache.Get(lockKey, azcache.CacheReadTypeDefault)
329325
if err != nil {
@@ -352,7 +348,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
352348
}
353349
}
354350

355-
if createPrivateEndpoint && protocol == NFS {
351+
if pointer.BoolDeref(createPrivateEndpoint, false) && protocol == NFS {
356352
// As for blobfuse/blobfuse2, serverName, i.e.,AZURE_STORAGE_BLOB_ENDPOINT env variable can't include
357353
// "privatelink", issue: https://github.com/Azure/azure-storage-fuse/issues/1014
358354
//

0 commit comments

Comments
 (0)