Fix: preserve user-configured PrivateEndpointNetworkPolicies on subnets#2961
Fix: preserve user-configured PrivateEndpointNetworkPolicies on subnets#2961
Conversation
|
Hi @Copilot. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
…change The issue was that even though the code checked if PrivateEndpointNetworkPolicies was already set to a value other than nil or Enabled, it would still call CreateOrUpdate on the subnet, which could cause Azure to reset the policy. This fix ensures that the subnet is only updated when we actually need to change the PrivateEndpointNetworkPolicies from nil or Enabled to Disabled. If the policy is already set to NetworkSecurityGroupEnabled or RouteTableEnabled, we skip the subnet update entirely. Co-authored-by: andyzhangx <4178417+andyzhangx@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Copilot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Co-authored-by: andyzhangx <4178417+andyzhangx@users.noreply.github.com>
|
hello, when we can expect to implement this fix? |
|
will fix it in another PR |
When creating private endpoints for Azure File storage, the driver unconditionally calls
CreateOrUpdateon subnets, overwriting user-configuredPrivateEndpointNetworkPolicies(e.g.,NetworkSecurityGroupEnabled,RouteTableEnabled) back toDisabled.Root Cause
The vendored cloud-provider-azure code checks if the policy is already set and logs accordingly, but still executes the subnet update:
Changes
Skip subnet update when
PrivateEndpointNetworkPoliciesis already configured to a non-Enabled value:Modified file:
vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/storage/azure_storageaccount.goWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
test.file.ut/tmp/go-build2503608668/b001/azurefile.test /tmp/go-build2503608668/b001/azurefile.test -test.testlogfile=/tmp/go-build2503608668/b001/testlog.txt -test.paniconexit0 -test.v=true -test.timeout=5m0s zcVHaXu6v .cfg ux_amd64/vet h.go /listers/resourc-atomic -lang=go1.24 ux_amd64/vet -o driver/azurefile-errorsas .cfg ux_amd64/vet /publicipprefixc/opt/hostedtoolcache/go/1.24.12/x64/pkg/tool/linux_amd64/vet d-provider-azure-atomic -lang=go1.24 ux_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>Azurefile with privateEndpoint forcibly disables NSGs from subnets network policy setting - AGAIN</issue_title>
<issue_description>
What happened:
I created an Azure File StorageClass with networkEndpointType: privateEndpoint in my AKS cluster, which is already integrated into my virtual network subnet. This subnet is configured with:
Private endpoint network policy:
Route tables, Network security groupsHowever, when I create a PVC using this Azure File StorageClass, the CSI driver overrides this setting and changes it to:
Private endpoint network policy:
DisabledThe same issue is described here:
#2634
According to this pull request, the issue has already been fixed:
#2637
So why is this still happening?
What you expected to happen:
I expected my setting to remain as i had pre-configured it with.
How to reproduce it:
I've implemented 2 new classes to my AKS
Then I deploy the following test resources:
After the PVC is created, the AKS managed identity performs a subnet write operation:
Microsoft.Network/virtualNetworks/subnets/write on /
This happens at the same time as PVC creation
Example Azure Activity Log event ( anonymized ):