Skip to content

Commit 3ced416

Browse files
authored
Merge pull request #172 from andyzhangx/private-link
feat: add storage account private link support
2 parents 0c39244 + 0df33dc commit 3ced416

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

deploy/example/pv-blobfuse-csi.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ spec:
1818
volumeHandle: uniqe-volumeid # make sure this volumeid is unique in the cluster
1919
volumeAttributes:
2020
containerName: EXISTING_CONTAINER_NAME
21+
server: SERVER_ADDRESS # optional, provide a new address to replace default "accountname.blob.core.windows.net"
2122
nodeStageSecretRef:
2223
name: azure-secret
2324
namespace: default

deploy/example/storageclass-blobfuse-csi-existing-container.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ parameters:
99
resourceGroup: EXISTING_RESOURCE_GROUP
1010
storageAccount: EXISTING_STORAGE_ACCOUNT
1111
containerName: EXISTING_CONTAINER_NAME
12+
server: SERVER_ADDRESS # optional, provide a new address to replace default "accountname.blob.core.windows.net"
1213
reclaimPolicy: Retain # if set as "Delete" container would be removed after pvc deletion
1314
volumeBindingMode: Immediate

docs/driver-parameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ location | specify the location in which blobfuse share will be created | `eastu
1515
resourceGroup | specify the existing resource group name where the container is | existing resource group name | No | if empty, driver will use the same resource group name as current k8s cluster
1616
storageAccount | specify the storage account name in which blobfuse share will be created | STORAGE_ACCOUNT_NAME | No | if empty, driver will find a suitable storage account that matches `skuName` in the same resource group; if a storage account name is provided, it means that storage account must exist otherwise there would be error
1717
containerName | specify the existing container name where blob storage will be created | existing container name | No | if empty, driver will create a new container name, starting with `pvc-fuse`
18+
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
1819

1920
- `fsGroup` securityContext setting
2021

pkg/blobfuse/blobfuse.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const (
4242
defaultFileMode = "0777"
4343
defaultDirMode = "0777"
4444
defaultVers = "3.0"
45+
serverNameField = "server"
4546

4647
// See https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names
4748
containerNameMinLength = 3

pkg/blobfuse/nodeserver.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,18 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
138138
for _, opt := range mountOptions {
139139
args = args + " " + opt
140140
}
141-
blobStorageEndPoint := fmt.Sprintf("%s.blob.%s", accountName, d.cloud.Environment.StorageEndpointSuffix)
141+
142+
var blobStorageEndPoint string
143+
for k, v := range attrib {
144+
switch strings.ToLower(k) {
145+
case serverNameField:
146+
blobStorageEndPoint = v
147+
}
148+
}
149+
if strings.TrimSpace(blobStorageEndPoint) == "" {
150+
// server address is "accountname.blob.core.windows.net" by default
151+
blobStorageEndPoint = fmt.Sprintf("%s.blob.%s", accountName, d.cloud.Environment.StorageEndpointSuffix)
152+
}
142153

143154
klog.V(2).Infof("target %v\nfstype %v\n\nvolumeId %v\ncontext %v\nmountflags %v\nmountOptions %v\nargs %v\nblobStorageEndPoint %v",
144155
targetPath, fsType, volumeID, attrib, mountFlags, mountOptions, args, blobStorageEndPoint)

0 commit comments

Comments
 (0)