Skip to content

Commit b4107d4

Browse files
authored
Merge pull request #2104 from andyzhangx/blobStorageAccountType-1.25
[release-1.25] feat: support blobStorageAccountType parameter in storage class or pv
2 parents 1f830d9 + efb2496 commit b4107d4

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

pkg/blob/blob.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const (
8585
storageSPNClientIDField = "azurestoragespnclientid"
8686
storageSPNTenantIDField = "azurestoragespntenantid"
8787
storageAuthTypeField = "azurestorageauthtype"
88+
blobStorageAccountTypeField = "blobstorageaccounttype"
8889
storageAuthTypeMSI = "msi"
8990
storageIdentityClientIDField = "azurestorageidentityclientid"
9091
storageIdentityObjectIDField = "azurestorageidentityobjectid"

pkg/blob/controllerserver.go

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

pkg/blob/controllerserver_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ func TestCreateVolume(t *testing.T) {
449449
mp[mountPermissionsField] = "0750"
450450
mp[storageAuthTypeField] = "msi"
451451
mp[storageIdentityClientIDField] = "msi"
452+
mp[blobStorageAccountTypeField] = "adls"
452453
mp[clientIDField] = "clientID"
453454
mp[mountWithWITokenField] = "true"
454455
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
118118
CSIDriver: testDriver,
119119
Pods: pods,
120120
StorageClassParameters: map[string]string{
121-
"skuName": "Standard_LRS",
122-
"secretNamespace": "default",
123-
"containerNamePrefix": "nameprefix",
124-
"accessTier": "Cool",
121+
"skuName": "Standard_LRS",
122+
"secretNamespace": "default",
123+
"containerNamePrefix": "nameprefix",
124+
"accessTier": "Cool",
125+
"blobStorageAccountType": "block",
125126
},
126127
}
127128
test.Run(ctx, cs, ns)

0 commit comments

Comments
 (0)