Skip to content

Commit 22dfa08

Browse files
authored
Merge pull request #2553 from kubernetes-sigs/vnetlink-access-1.32
[release-1.32] feat: add VNetLinkName and PublicNetworkAccess in account creation
2 parents d805ca3 + 6d90b0f commit 22dfa08

File tree

12 files changed

+105
-15
lines changed

12 files changed

+105
-15
lines changed

docs/driver-parameters.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ vnetResourceGroup | specify vnet resource group where virtual network is | exist
6767
vnetName | virtual network name | existing virtual network name | No | if empty, driver will use the `vnetName` value in azure cloud config file
6868
subnetName | subnet name | existing subnet name(s) of virtual network, if you want to update service endpoints on multiple subnets, separate them using a comma (`,`) | No | if empty, driver will use the `subnetName` value in azure cloud config file
6969
fsGroupChangePolicy | indicates how volume's ownership will be changed by the driver, pod `securityContext.fsGroupChangePolicy` is ignored | `OnRootMismatch`(by default), `Always`, `None` | No | `OnRootMismatch`
70+
vnetLinkName | virtual network link name associated with private dns zone | | No | if empty, driver will use the `vnetName + "-vnetlink"` by default
71+
publicNetworkAccess | `PublicNetworkAccess` property of created storage account by the driver | `Enabled`, `Disabled`, `SecuredByPerimeter` | No |
7072

7173
- account tags format created by dynamic provisioning
7274
```

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ require (
4242
k8s.io/mount-utils v0.32.1
4343
k8s.io/pod-security-admission v0.32.1
4444
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e
45-
sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250425133425-2efcaed305f8
45+
sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250430201754-d0603ee5c5a7
4646
sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.6.2
47-
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.5.2
47+
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.5.3
4848
sigs.k8s.io/yaml v1.4.0
4949
)
5050

@@ -182,7 +182,7 @@ require (
182182
k8s.io/kubectl v0.0.0 // indirect
183183
k8s.io/kubelet v0.32.4 // indirect
184184
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 // indirect
185-
sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache v0.6.0 // indirect
185+
sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache v0.6.1 // indirect
186186
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
187187
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
188188
)

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -893,14 +893,14 @@ k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e h1:KqK5c/ghOm8xkHYhlodbp6i6+r+Ch
893893
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
894894
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
895895
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
896-
sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250425133425-2efcaed305f8 h1:6SQj82q2K+kJqqSJf13Z+1qqZrxheNWBhZbdyOxMb0A=
897-
sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250425133425-2efcaed305f8/go.mod h1:6BBnJ5zA/rD0DQwpSi3hrhH42qFcdXKqQIsbs7TBoUU=
896+
sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250430201754-d0603ee5c5a7 h1:8jZvDWIksSi4gqFfNUKHM3Xr0XdGFVQQnMTv1gJho2E=
897+
sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250430201754-d0603ee5c5a7/go.mod h1:E2qP7+4lOorrXzX5rPNKxdNSCV2qoFNaL8b+CbWCN2M=
898898
sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.6.2 h1:9vsKWUUg5ZPrgx1OTvuJ+tbXU5zt2nOhEt7T1ZlmQ+U=
899899
sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.6.2/go.mod h1:QFx8YimjDv3fcvpJ1vGey5i8ZDOYmUXWAP1XV9eLVlg=
900-
sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache v0.6.0 h1:Yz3Uj7sYMiLPgTtPiJECcJdjRiOrCHy6Lyp++CWEI4c=
901-
sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache v0.6.0/go.mod h1:/7xowKtaqHtz6/Uo6EnIoAlMZJRFgQG6cjmfWt7wxdo=
902-
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.5.2 h1:jjFJF0PmS9IHLokD41mM6RVoqQF3BQtVDmQd6ZMnN6E=
903-
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.5.2/go.mod h1:7DdZ9ipIsmPLpBlfT4gueejcUlJBZQKWhdljQE5SKvc=
900+
sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache v0.6.1 h1:3jit+5cskDTISeQUbkoiapdkN2dqQsLxE+zdKMf4dbc=
901+
sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache v0.6.1/go.mod h1:Gn9ASG6kY9sRvTfuh+HlP5MBWcmQqu+vAmzO47Hon4c=
902+
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.5.3 h1:PiQy1U20uPkBgdpbERnX3BZ4bB6tljBJKU9wXmn1GrI=
903+
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.5.3/go.mod h1:eBK7J+xfuzLATTK5ALuERxsZv7O4kncWnCW5ILCLX0w=
904904
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
905905
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
906906
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=

pkg/azurefile/azurefile.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const (
120120
getAccountKeyFromSecretField = "getaccountkeyfromsecret"
121121
disableDeleteRetentionPolicyField = "disabledeleteretentionpolicy"
122122
allowBlobPublicAccessField = "allowblobpublicaccess"
123+
publicNetworkAccessField = "publicnetworkaccess"
123124
allowSharedKeyAccessField = "allowsharedkeyaccess"
124125
storageEndpointSuffixField = "storageendpointsuffix"
125126
fsGroupChangePolicyField = "fsgroupchangepolicy"
@@ -148,6 +149,7 @@ const (
148149
networkEndpointTypeField = "networkendpointtype"
149150
vnetResourceGroupField = "vnetresourcegroup"
150151
vnetNameField = "vnetname"
152+
vnetLinkNameField = "vnetlinkname"
151153
subnetNameField = "subnetname"
152154
shareNamePrefixField = "sharenameprefix"
153155
requireInfraEncryptionField = "requireinfraencryption"
@@ -921,6 +923,18 @@ func isSupportedAccountAccessTier(accessTier string) bool {
921923
return false
922924
}
923925

926+
func isSupportedPublicNetworkAccess(publicNetworkAccess string) bool {
927+
if publicNetworkAccess == "" {
928+
return true
929+
}
930+
for _, tier := range armstorage.PossiblePublicNetworkAccessValues() {
931+
if publicNetworkAccess == string(tier) {
932+
return true
933+
}
934+
}
935+
return false
936+
}
937+
924938
func isSupportedRootSquashType(rootSquashType string) bool {
925939
if rootSquashType == "" {
926940
return true

pkg/azurefile/azurefile_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,3 +1885,34 @@ func TestSetAzureCredentials(t *testing.T) {
18851885
})
18861886
}
18871887
}
1888+
1889+
func TestIsSupportedPublicNetworkAccess(t *testing.T) {
1890+
tests := []struct {
1891+
publicNetworkAccess string
1892+
expectedResult bool
1893+
}{
1894+
{
1895+
publicNetworkAccess: "",
1896+
expectedResult: true,
1897+
},
1898+
{
1899+
publicNetworkAccess: "Enabled",
1900+
expectedResult: true,
1901+
},
1902+
{
1903+
publicNetworkAccess: "Disabled",
1904+
expectedResult: true,
1905+
},
1906+
{
1907+
publicNetworkAccess: "InvalidValue",
1908+
expectedResult: false,
1909+
},
1910+
}
1911+
1912+
for _, test := range tests {
1913+
result := isSupportedPublicNetworkAccess(test.publicNetworkAccess)
1914+
if result != test.expectedResult {
1915+
t.Errorf("isSupportedPublicNetworkAccess(%s) returned %v, expected %v", test.publicNetworkAccess, result, test.expectedResult)
1916+
}
1917+
}
1918+
}

pkg/azurefile/controllerserver.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
118118
var sku, subsID, resourceGroup, location, account, fileShareName, diskName, fsType, secretName string
119119
var secretNamespace, pvcNamespace, protocol, customTags, storageEndpointSuffix, networkEndpointType, shareAccessTier, accountAccessTier, rootSquashType, tagValueDelimiter string
120120
var createAccount, useSeretCache, matchTags, selectRandomMatchingAccount, getLatestAccountKey bool
121-
var vnetResourceGroup, vnetName, subnetName, shareNamePrefix, fsGroupChangePolicy, useDataPlaneAPI string
121+
var vnetResourceGroup, vnetName, vnetLinkName, publicNetworkAccess, subnetName, shareNamePrefix, fsGroupChangePolicy, useDataPlaneAPI string
122122
var requireInfraEncryption, disableDeleteRetentionPolicy, enableLFS, isMultichannelEnabled, allowSharedKeyAccess *bool
123123
// set allowBlobPublicAccess as false by default
124124
allowBlobPublicAccess := ptr.To(false)
@@ -212,6 +212,8 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
212212
return nil, status.Errorf(codes.InvalidArgument, "invalid %s: %s in storage class", allowBlobPublicAccessField, v)
213213
}
214214
allowBlobPublicAccess = &value
215+
case publicNetworkAccessField:
216+
publicNetworkAccess = v
215217
case allowSharedKeyAccessField:
216218
value, err := strconv.ParseBool(v)
217219
if err != nil {
@@ -237,6 +239,8 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
237239
vnetResourceGroup = v
238240
case vnetNameField:
239241
vnetName = v
242+
case vnetLinkNameField:
243+
vnetLinkName = v
240244
case subnetNameField:
241245
subnetName = v
242246
case shareNamePrefixField:
@@ -322,6 +326,10 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
322326
return nil, status.Errorf(codes.InvalidArgument, "shareNamePrefix(%s) can only contain lowercase letters, numbers, hyphens, and length should be less than 21", shareNamePrefix)
323327
}
324328

329+
if !isSupportedPublicNetworkAccess(publicNetworkAccess) {
330+
return nil, status.Errorf(codes.InvalidArgument, "publicNetworkAccess(%s) is not supported, supported PublicNetworkAccess list: %v", publicNetworkAccess, armstorage.PossiblePublicNetworkAccessValues())
331+
}
332+
325333
if protocol == nfs && fsType != "" && fsType != nfs {
326334
return nil, status.Errorf(codes.InvalidArgument, "fsType(%s) is not supported with protocol(%s)", fsType, protocol)
327335
}
@@ -480,8 +488,10 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
480488
DisableFileServiceDeleteRetentionPolicy: disableDeleteRetentionPolicy,
481489
AllowBlobPublicAccess: allowBlobPublicAccess,
482490
AllowSharedKeyAccess: allowSharedKeyAccess,
491+
PublicNetworkAccess: publicNetworkAccess,
483492
VNetResourceGroup: vnetResourceGroup,
484493
VNetName: vnetName,
494+
VNetLinkName: vnetLinkName,
485495
SubnetName: subnetName,
486496
RequireInfrastructureEncryption: requireInfraEncryption,
487497
AccessTier: accountAccessTier,

pkg/azurefile/controllerserver_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,23 @@ var _ = ginkgo.Describe("TestCreateVolume", func() {
265265
gomega.Expect(err).To(gomega.Equal(expectedErr))
266266
})
267267
})
268+
ginkgo.When("Invalid PublicNetworkAccess", func() {
269+
ginkgo.It("should fail", func(ctx context.Context) {
270+
allParam := map[string]string{
271+
publicNetworkAccessField: "test_publicNetworkAccess",
272+
}
273+
274+
req := &csi.CreateVolumeRequest{
275+
Name: "PublicNetworkAccess-invalid",
276+
CapacityRange: stdCapRange,
277+
VolumeCapabilities: stdVolCap,
278+
Parameters: allParam,
279+
}
280+
expectedErr := status.Errorf(codes.InvalidArgument, "publicNetworkAccess(%s) is not supported, supported PublicNetworkAccess list: %v", "test_publicNetworkAccess", armstorage.PossiblePublicNetworkAccessValues())
281+
_, err := d.CreateVolume(ctx, req)
282+
gomega.Expect(err).To(gomega.Equal(expectedErr))
283+
})
284+
})
268285
ginkgo.When("nfs protocol only supports premium storage", func() {
269286
ginkgo.It("should fail", func(ctx context.Context) {
270287
allParam := map[string]string{
@@ -529,6 +546,7 @@ var _ = ginkgo.Describe("TestCreateVolume", func() {
529546
ginkgo.It("should fail", func(ctx context.Context) {
530547
allParam := map[string]string{
531548
networkEndpointTypeField: "privateendpoint",
549+
vnetLinkNameField: "vnetlink",
532550
subnetNameField: "subnet1,subnet2",
533551
}
534552

test/e2e/dynamic_provisioning_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,7 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() {
14801480
scParameters := map[string]string{
14811481
"protocol": "nfs",
14821482
"networkEndpointType": "privateEndpoint",
1483+
"publicNetworkAccess": "Disabled",
14831484
"skuName": "Premium_LRS",
14841485
"rootSquashType": "AllSquash",
14851486
"mountPermissions": "0",

vendor/modules.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client
18731873
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics
18741874
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics
18751875
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client
1876-
# sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250425133425-2efcaed305f8
1876+
# sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250430201754-d0603ee5c5a7
18771877
## explicit; go 1.23.2
18781878
sigs.k8s.io/cloud-provider-azure/pkg/cache
18791879
sigs.k8s.io/cloud-provider-azure/pkg/consts
@@ -1988,10 +1988,10 @@ sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient
19881988
sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/mock_virtualnetworkclient
19891989
sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient
19901990
sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/mock_virtualnetworklinkclient
1991-
# sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache v0.6.0
1991+
# sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache v0.6.1
19921992
## explicit; go 1.23.0
19931993
sigs.k8s.io/cloud-provider-azure/pkg/azclient/cache
1994-
# sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.5.2
1994+
# sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.5.3
19951995
## explicit; go 1.23.0
19961996
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader
19971997
# sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3

vendor/sigs.k8s.io/cloud-provider-azure/pkg/consts/consts.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)