Skip to content

Commit 25b7fe3

Browse files
committed
feat: add requireInfraEncryption parameter in storage class
1 parent 55e6daf commit 25b7fe3

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

docs/driver-parameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ containerName | specify the existing container(directory) name | existing contai
1717
containerNamePrefix | specify Azure storage directory prefix created by driver | can only contain lowercase letters, numbers, hyphens, and length should be less than 21 | No |
1818
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
1919
allowBlobPublicAccess | Allow or disallow public access to all blobs or containers for storage account created by driver | `true`,`false` | No | `false`
20+
requireInfraEncryption | specify whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest for storage account created by driver | `true`,`false` | No | `false`
2021
storageEndpointSuffix | specify Azure storage endpoint suffix | `core.windows.net`, `core.chinacloudapi.cn`, etc | No | if empty, driver will use default storage endpoint suffix according to cloud environment
2122
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 | ""
2223
matchTags | whether matching tags when driver tries to find a suitable storage account | `true`,`false` | No | `false`

pkg/blob/blob.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const (
7676
keyVaultSecretVersionField = "keyvaultsecretversion"
7777
storageAccountNameField = "storageaccountname"
7878
allowBlobPublicAccessField = "allowblobpublicaccess"
79+
requireInfraEncryptionField = "requireinfraencryption"
7980
ephemeralField = "csi.storage.k8s.io/ephemeral"
8081
podNamespaceField = "csi.storage.k8s.io/pod.namespace"
8182
mountOptionsField = "mountoptions"

pkg/blob/controllerserver.go

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
6868
parameters = make(map[string]string)
6969
}
7070
var storageAccountType, subsID, resourceGroup, location, account, containerName, containerNamePrefix, protocol, customTags, secretName, secretNamespace, pvcNamespace string
71-
var isHnsEnabled *bool
71+
var isHnsEnabled, requireInfraEncryption *bool
7272
var vnetResourceGroup, vnetName, subnetName string
7373
var matchTags, useDataPlaneAPI bool
7474
// set allowBlobPublicAccess as false by default
@@ -121,6 +121,10 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
121121
if strings.EqualFold(v, trueValue) {
122122
allowBlobPublicAccess = to.BoolPtr(true)
123123
}
124+
case requireInfraEncryptionField:
125+
if strings.EqualFold(v, trueValue) {
126+
requireInfraEncryption = to.BoolPtr(true)
127+
}
124128
case pvcNamespaceKey:
125129
pvcNamespace = v
126130
containerNameReplaceMap[pvcNamespaceMetadata] = v
@@ -228,22 +232,23 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
228232
}
229233

230234
accountOptions := &azure.AccountOptions{
231-
Name: account,
232-
Type: storageAccountType,
233-
Kind: accountKind,
234-
SubscriptionID: subsID,
235-
ResourceGroup: resourceGroup,
236-
Location: location,
237-
EnableHTTPSTrafficOnly: enableHTTPSTrafficOnly,
238-
VirtualNetworkResourceIDs: vnetResourceIDs,
239-
Tags: tags,
240-
MatchTags: matchTags,
241-
IsHnsEnabled: isHnsEnabled,
242-
EnableNfsV3: enableNfsV3,
243-
AllowBlobPublicAccess: allowBlobPublicAccess,
244-
VNetResourceGroup: vnetResourceGroup,
245-
VNetName: vnetName,
246-
SubnetName: subnetName,
235+
Name: account,
236+
Type: storageAccountType,
237+
Kind: accountKind,
238+
SubscriptionID: subsID,
239+
ResourceGroup: resourceGroup,
240+
Location: location,
241+
EnableHTTPSTrafficOnly: enableHTTPSTrafficOnly,
242+
VirtualNetworkResourceIDs: vnetResourceIDs,
243+
Tags: tags,
244+
MatchTags: matchTags,
245+
IsHnsEnabled: isHnsEnabled,
246+
EnableNfsV3: enableNfsV3,
247+
AllowBlobPublicAccess: allowBlobPublicAccess,
248+
RequireInfrastructureEncryption: requireInfraEncryption,
249+
VNetResourceGroup: vnetResourceGroup,
250+
VNetName: vnetName,
251+
SubnetName: subnetName,
247252
}
248253

249254
var accountKey string

test/e2e/dynamic_provisioning_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
8585
"skuName": "Standard_GRS",
8686
"secretNamespace": "default",
8787
// make sure this is the first test case due to storeAccountKey is set as false
88-
"storeAccountKey": "false",
88+
"storeAccountKey": "false",
89+
"requireInfraEncryption": "true",
8990
},
9091
}
9192
test.Run(cs, ns)

0 commit comments

Comments
 (0)