Skip to content

Commit 6a46f80

Browse files
authored
Merge pull request #488 from andyzhangx/adls
feat: support Azure DataLake account for blobfuse
2 parents 8eb3d65 + 67f974c commit 6a46f80

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

docs/driver-parameters.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ storageAccount | specify Azure storage account name| STORAGE_ACCOUNT_NAME | - No
1515
storeAccountKey | whether store account key to k8s secret | `true`,`false` | No | `true`
1616
protocol | specify blobfuse mount or NFSv3 mount | `fuse`, `nfs` | No | `fuse`
1717
containerName | specify the existing container name | existing container name | No | if empty, driver will create a new container name, starting with `pvc-fuse` for blobfuse or `pvc-nfs` for NFSv3
18+
isHnsEnabled | enable `Hierarchical namespace` for Azure DataLake storage account(only for blobfuse) | `true`,`false` | No | `false`
1819
server | specify Azure storage account server address | existing server address, e.g. `accountname.privatelink.blob.core.windows.net` | No | if empty, driver will use default `accountname.blob.core.windows.net` or other sovereign cloud account address
1920
storageEndpointSuffix | specify Azure storage endpoint suffix | `core.windows.net` | No | if empty, driver will use default storage endpoint suffix according to cloud environment, e.g. `core.windows.net`
2021
tags | [tags](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources) would be created in newly created storage account | tag format: 'foo=aaa,bar=bbb' | No | ""
@@ -23,6 +24,10 @@ tags | [tags](https://docs.microsoft.com/en-us/azure/azure-resource-manager/mana
2324

2425
Blobfuse driver does not honor `fsGroup` securityContext setting, instead user could use `-o gid=1000` in `mountoptions` to set ownership, check [here](https://github.com/Azure/Azure-storage-fuse#mount-options) for more mountoptions.
2526

27+
- Azure DataLake storage account support
28+
- set `isHnsEnabled: "true"` in storage class parameter to create ADLS account by driver.
29+
- mount option `--use-adls=true` must be specified to enable blobfuse access ADLS account.
30+
2631
- account tags format created by dynamic provisioning
2732
```
2833
created-by: azure

pkg/blob/blob.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const (
6161
secretNamespaceField = "secretnamespace"
6262
containerNameField = "containername"
6363
storeAccountKeyField = "storeaccountkey"
64+
isHnsEnabledField = "ishnsenabled"
6465
getAccountKeyFromSecretField = "getaccountkeyfromsecret"
6566
keyVaultURLField = "keyvaulturl"
6667
keyVaultSecretNameField = "keyvaultsecretname"

pkg/blob/controllerserver.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
6666
parameters = make(map[string]string)
6767
}
6868
var storageAccountType, resourceGroup, location, account, containerName, protocol, customTags, secretNamespace string
69+
var isHnsEnabled *bool
6970

7071
// store account key to k8s secret by default
7172
storeAccountKey := true
@@ -92,6 +93,10 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
9293
customTags = v
9394
case secretNamespaceField:
9495
secretNamespace = v
96+
case isHnsEnabledField:
97+
if strings.EqualFold(v, trueValue) {
98+
isHnsEnabled = to.BoolPtr(true)
99+
}
95100
case storeAccountKeyField:
96101
if strings.EqualFold(v, falseValue) {
97102
storeAccountKey = false
@@ -127,8 +132,10 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
127132

128133
enableHTTPSTrafficOnly := true
129134
accountKind := string(storage.KindStorageV2)
130-
var vnetResourceIDs []string
131-
var isHnsEnabled, enableNfsV3 *bool
135+
var (
136+
vnetResourceIDs []string
137+
enableNfsV3 *bool
138+
)
132139
if protocol == nfs {
133140
enableHTTPSTrafficOnly = false
134141
isHnsEnabled = to.BoolPtr(true)

pkg/blob/nodeserver.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
211211
secrets := req.GetSecrets()
212212

213213
var serverAddress, storageEndpointSuffix, protocol, ephemeralVolMountOptions string
214-
var ephemeralVol bool
214+
var ephemeralVol, isHnsEnabled bool
215215
for k, v := range attrib {
216216
switch strings.ToLower(k) {
217217
case serverNameField:
@@ -224,6 +224,8 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
224224
ephemeralVol = strings.EqualFold(v, trueValue)
225225
case mountOptionsField:
226226
ephemeralVolMountOptions = v
227+
case isHnsEnabledField:
228+
isHnsEnabled = strings.EqualFold(v, trueValue)
227229
}
228230
}
229231

@@ -271,6 +273,9 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
271273
if ephemeralVol {
272274
mountOptions = util.JoinMountOptions(mountOptions, strings.Split(ephemeralVolMountOptions, ","))
273275
}
276+
if isHnsEnabled {
277+
mountOptions = util.JoinMountOptions(mountOptions, []string{"--use-adls=true"})
278+
}
274279
// set different tmp-path with time info
275280
tmpPath := fmt.Sprintf("%s/%s#%d", "/mnt", volumeID, time.Now().Unix())
276281
mountOptions = appendDefaultMountOptions(mountOptions, tmpPath, containerName)

test/e2e/dynamic_provisioning_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
147147
Cmd: []string{"cat", "/mnt/test-1/data"},
148148
ExpectedString: "hello world\nhello world\n", // pod will be restarted so expect to see 2 instances of string
149149
},
150-
StorageClassParameters: map[string]string{"skuName": "Premium_LRS"},
150+
StorageClassParameters: map[string]string{
151+
"skuName": "Premium_LRS",
152+
"isHnsEnabled": "true",
153+
},
151154
}
152155
test.Run(cs, ns)
153156
})

0 commit comments

Comments
 (0)