Skip to content

Commit 938f25b

Browse files
committed
feat: support blobStorageAccountType parameter in storage class or pv
1 parent 329fce6 commit 938f25b

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

pkg/blob/blob.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const (
8383
storageSPNClientIDField = "azurestoragespnclientid"
8484
storageSPNTenantIDField = "azurestoragespntenantid"
8585
storageAuthTypeField = "azurestorageauthtype"
86+
blobStorageAccountTypeField = "blobstorageaccounttype"
8687
storageAuthTypeMSI = "msi"
8788
storageIdentityClientIDField = "azurestorageidentityclientid"
8889
storageIdentityObjectIDField = "azurestorageidentityobjectid"

pkg/blob/controllerserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
193193
case tenantIDField:
194194
case msiEndpointField:
195195
case storageAADEndpointField:
196+
case blobStorageAccountTypeField:
196197
// no op, only used in NodeStageVolume
197198
case storageEndpointSuffixField:
198199
storageEndpointSuffix = v

pkg/blob/controllerserver_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ func TestCreateVolume(t *testing.T) {
439439
mp[mountPermissionsField] = "0750"
440440
mp[storageAuthTypeField] = "msi"
441441
mp[storageIdentityClientIDField] = "msi"
442+
mp[blobStorageAccountTypeField] = "adls"
442443
mp[clientIDField] = "clientID"
443444
mp[mountWithWITokenField] = "true"
444445
mp[tenantIDField] = "tenantID"

pkg/blob/nodeserver.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
272272
mc.ObserveOperationWithResult(isOperationSucceeded, VolumeID, volumeID)
273273
}()
274274

275-
var serverAddress, storageEndpointSuffix, protocol, ephemeralVolMountOptions string
275+
var serverAddress, storageEndpointSuffix, protocol, ephemeralVolMountOptions, blobStorageAccountType string
276276
var ephemeralVol, isHnsEnabled bool
277277

278278
containerNameReplaceMap := map[string]string{}
@@ -316,6 +316,8 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
316316
}
317317
case fsGroupChangePolicyField:
318318
fsGroupChangePolicy = v
319+
case blobStorageAccountTypeField:
320+
blobStorageAccountType = v
319321
}
320322
}
321323

@@ -435,6 +437,10 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
435437
targetPath, protocol, volumeID, mountFlags, mountOptions, volumeMountGroup, args, serverAddress)
436438

437439
authEnv = append(authEnv, "AZURE_STORAGE_ACCOUNT="+accountName, "AZURE_STORAGE_BLOB_ENDPOINT="+serverAddress)
440+
if blobStorageAccountType != "" {
441+
klog.V(2).Infof("set AZURE_STORAGE_ACCOUNT_TYPE to %s", blobStorageAccountType)
442+
authEnv = append(authEnv, "AZURE_STORAGE_ACCOUNT_TYPE="+blobStorageAccountType)
443+
}
438444
if d.enableBlobMockMount {
439445
klog.Warningf("NodeStageVolume: mock mount on volumeID(%s), this is only for TESTING!!!", volumeID)
440446
if err := volumehelper.MakeDir(targetPath, os.FileMode(mountPermissions)); err != nil {

test/e2e/dynamic_provisioning_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,9 +713,10 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
713713
CSIDriver: testDriver,
714714
Pods: pods,
715715
StorageClassParameters: map[string]string{
716-
"skuName": "Standard_LRS",
717-
"networkEndpointType": "privateEndpoint",
718-
"publicNetworkAccess": "Disabled",
716+
"skuName": "Standard_LRS",
717+
"networkEndpointType": "privateEndpoint",
718+
"publicNetworkAccess": "Disabled",
719+
"blobStorageAccountType": "block",
719720
},
720721
}
721722
test.Run(ctx, cs, ns)

0 commit comments

Comments
 (0)