diff --git a/pkg/blob/blob.go b/pkg/blob/blob.go index 15c2d989d..86b3e7c1f 100644 --- a/pkg/blob/blob.go +++ b/pkg/blob/blob.go @@ -85,6 +85,7 @@ const ( storageSPNClientIDField = "azurestoragespnclientid" storageSPNTenantIDField = "azurestoragespntenantid" storageAuthTypeField = "azurestorageauthtype" + blobStorageAccountTypeField = "blobstorageaccounttype" storageAuthTypeMSI = "msi" storageIdentityClientIDField = "azurestorageidentityclientid" storageIdentityObjectIDField = "azurestorageidentityobjectid" diff --git a/pkg/blob/controllerserver.go b/pkg/blob/controllerserver.go index 7289c7eca..3fce6111b 100644 --- a/pkg/blob/controllerserver.go +++ b/pkg/blob/controllerserver.go @@ -192,6 +192,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) case tenantIDField: case msiEndpointField: case storageAADEndpointField: + case blobStorageAccountTypeField: // no op, only used in NodeStageVolume case storageEndpointSuffixField: storageEndpointSuffix = v diff --git a/pkg/blob/controllerserver_test.go b/pkg/blob/controllerserver_test.go index 6beeafb0d..a395b7024 100644 --- a/pkg/blob/controllerserver_test.go +++ b/pkg/blob/controllerserver_test.go @@ -449,6 +449,7 @@ func TestCreateVolume(t *testing.T) { mp[mountPermissionsField] = "0750" mp[storageAuthTypeField] = "msi" mp[storageIdentityClientIDField] = "msi" + mp[blobStorageAccountTypeField] = "adls" mp[clientIDField] = "clientID" mp[mountWithWITokenField] = "true" mp[tenantIDField] = "tenantID" diff --git a/pkg/blob/nodeserver.go b/pkg/blob/nodeserver.go index 84ef09312..8e349f25f 100644 --- a/pkg/blob/nodeserver.go +++ b/pkg/blob/nodeserver.go @@ -272,7 +272,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe mc.ObserveOperationWithResult(isOperationSucceeded, VolumeID, volumeID) }() - var serverAddress, storageEndpointSuffix, protocol, ephemeralVolMountOptions string + var serverAddress, storageEndpointSuffix, protocol, ephemeralVolMountOptions, blobStorageAccountType string var ephemeralVol, isHnsEnabled bool containerNameReplaceMap := map[string]string{} @@ -316,6 +316,8 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe } case fsGroupChangePolicyField: fsGroupChangePolicy = v + case blobStorageAccountTypeField: + blobStorageAccountType = v } } @@ -435,6 +437,10 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe targetPath, protocol, volumeID, mountFlags, mountOptions, volumeMountGroup, args, serverAddress) authEnv = append(authEnv, "AZURE_STORAGE_ACCOUNT="+accountName, "AZURE_STORAGE_BLOB_ENDPOINT="+serverAddress) + if blobStorageAccountType != "" { + klog.V(2).Infof("set AZURE_STORAGE_ACCOUNT_TYPE to %s", blobStorageAccountType) + authEnv = append(authEnv, "AZURE_STORAGE_ACCOUNT_TYPE="+blobStorageAccountType) + } if d.enableBlobMockMount { klog.Warningf("NodeStageVolume: mock mount on volumeID(%s), this is only for TESTING!!!", volumeID) if err := volumehelper.MakeDir(targetPath, os.FileMode(mountPermissions)); err != nil { diff --git a/test/e2e/dynamic_provisioning_test.go b/test/e2e/dynamic_provisioning_test.go index 9057a3eb3..e10eda557 100644 --- a/test/e2e/dynamic_provisioning_test.go +++ b/test/e2e/dynamic_provisioning_test.go @@ -118,10 +118,11 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() { CSIDriver: testDriver, Pods: pods, StorageClassParameters: map[string]string{ - "skuName": "Standard_LRS", - "secretNamespace": "default", - "containerNamePrefix": "nameprefix", - "accessTier": "Cool", + "skuName": "Standard_LRS", + "secretNamespace": "default", + "containerNamePrefix": "nameprefix", + "accessTier": "Cool", + "blobStorageAccountType": "block", }, } test.Run(ctx, cs, ns)