fix(aks-preview): preserve existing ACNS settings during partial updates#9720
fix(aks-preview): preserve existing ACNS settings during partial updates#9720nddq wants to merge 1 commit intoAzure:mainfrom
Conversation
️✔️Azure CLI Extensions Breaking Change Test
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
Hi @nddq, |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
|
Hi @nddq Release SuggestionsModule: aks-preview
Notes
|
There was a problem hiding this comment.
Pull request overview
This PR updates the aks-preview managed cluster update path so partial ACNS updates (e.g., changing only advanced network policies or transit encryption) don’t unintentionally wipe other existing advancedNetworking sub-settings.
Changes:
- Update
update_acns_in_network_profileto mutatemc.network_profile.advanced_networkingin-place instead of replacing it wholesale. - Add a unit test covering preservation of existing ACNS state across partial updates.
- Add a live test that creates a cluster with ACNS and verifies settings persist across sequential partial updates.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/aks-preview/azext_aks_preview/managed_cluster_decorator.py |
Switch ACNS update logic to preserve existing advanced_networking sub-objects and only overwrite user-specified fields. |
src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py |
Add unit coverage for preserving existing ACNS settings during partial updates (and disable path expectations). |
src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py |
Add a live test validating partial aks update operations don’t drop previously configured ACNS settings. |
src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py
Outdated
Show resolved
Hide resolved
src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py
Show resolved
Hide resolved
The update_acns_in_network_profile method was creating a new AdvancedNetworking object on every update, discarding existing sub-properties (observability, security, transit encryption, performance) that the user didn't explicitly specify. This changes the method to modify the existing object in-place, only overwriting fields the user provided. Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
2991958 to
08a5334
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
FumingZhang
left a comment
There was a problem hiding this comment.
Please leave a note about your change in HISTORY.rst
| name_prefix="clitest", | ||
| location="westcentralus", | ||
| ) | ||
| def test_aks_update_acns_preserves_existing_settings( |
There was a problem hiding this comment.
Queued live test to validate the change.
You might consider running the test with other related existing test cases to make sure the change doesn't cause any regression.
Currently
update_acns_in_network_profilecreates a newAdvancedNetworkingobject on every update call, replacing the existing one wholesale. When a user updates only a single ACNS sub-property (e.g.--acns-advanced-networkpolicies L7), existing sub-properties like observability, security, transit encryption, and performance are discarded because they weren't re-specified.This PR changes the update path to modify the existing
AdvancedNetworkingobject in-place, only overwriting fields the user explicitly provided.mc.network_profile.advanced_networkingin-place instead of constructing a fresh object and replacing ittest_update_acns_in_network_profile_preserves_existing_statecovering partial updates to network policies, observability, and disable flowstest_aks_update_acns_preserves_existing_settings— creates a cluster with ACNS, updates only network policies, then updates only transit encryption, verifying all existing settings survive each stepTesting
Unit tests:
Live test: