[AKS] Fix load balancer options ignored when outbound type is not loadBalancer - #10233
Conversation
…dBalancer `az aks update --load-balancer-backend-pool-type nodeIP` was silently ignored on clusters whose outboundType is not loadBalancer (userDefinedRouting, NAT gateway, none, block). update_load_balancer_profile read the outbound type through get_outbound_type, which since 073b19f falls back to the value on the existing cluster. An unchanged outbound type therefore looked like a request to switch away from loadBalancer, and the whole profile was set to None. The request carried no loadBalancerProfile at all, so AKS applied nothing and returned success, leaving the cluster on nodeIPConfiguration. Read outbound_type from the raw command parameters instead, so only an outbound type given on the command line counts as a switch, and clear just the five outbound fields rather than the whole profile. Inbound settings such as backendPoolType are valid for every outbound type and are now preserved, including when requested in the same command that changes --outbound-type. When no inbound settings remain the profile is still set to None, so the request body continues to omit loadBalancerProfile rather than sending an empty object. Affected versions: 21.0.0b10 through 22.0.0b1.
|
Hi Liunardy, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Fixes an az aks update behavior regression in the aks-preview extension where load balancer profile updates (notably --load-balancer-backend-pool-type) could be silently ignored when the cluster’s existing outboundType is not loadBalancer, by ensuring only an explicitly provided --outbound-type triggers “switch away from loadBalancer” logic and by clearing only outbound-related LB fields rather than dropping the entire profile.
Changes:
- Update load balancer profile handling to read
outbound_typefrom raw command parameters and preserve inbound LB settings across outbound-type changes. - Add focused unit tests covering outbound-type specified vs. not specified, and verifying correct preservation/clearing behavior.
- Bump extension version to
22.0.0b2and document the fix inHISTORY.rst.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/aks-preview/azext_aks_preview/managed_cluster_decorator.py | Fixes LB profile update logic so inbound settings (e.g., backendPoolType) are preserved unless --outbound-type is explicitly switching away from loadBalancer, and only outbound fields are cleared. |
| src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py | Adds regression tests validating the corrected behavior for various outbound types and switch scenarios. |
| src/aks-preview/HISTORY.rst | Adds release note entry for 22.0.0b2 describing the fix. |
| src/aks-preview/setup.py | Bumps extension version to 22.0.0b2. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
AKS |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
[Release] Update index.json for extension [ aks-preview-22.0.0b2 ] : https://dev.azure.com/msazure/One/_build/results?buildId=177394889&view=results |
🤖 PR Validation — ️✔️ All clear
az aks update --load-balancer-backend-pool-type nodeIPwas silently ignored on clusters whose outboundType is not loadBalancer (userDefinedRouting, NAT gateway, none, block). update_load_balancer_profile read the outbound type through get_outbound_type, which since 073b19f falls back to the value on the existing cluster. An unchanged outbound type therefore looked like a request to switch away from loadBalancer, and the whole profile was set to None. The request carried no loadBalancerProfile at all, so AKS applied nothing and returned success, leaving the cluster on nodeIPConfiguration.Read outbound_type from the raw command parameters instead, so only an outbound type given on the command line counts as a switch, and clear just the five outbound fields rather than the whole profile. Inbound settings such as backendPoolType are valid for every outbound type and are now preserved, including when requested in the same command that changes --outbound-type. When no inbound settings remain the profile is still set to None, so the request body continues to omit loadBalancerProfile rather than sending an empty object.
Affected versions: 21.0.0b10 through 22.0.0b1.
Testing
Verified live: on a userDefinedRouting cluster
--load-balancer-backend-pool-type nodeIPnow reaches AKS and applies. On a loadBalancer cluster--outbound-type userDefinedRouting --load-balancer-backend-pool-type nodeIPConfigurationapplies both changes and clears managedOutboundIPs.This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az aks update --load-balancer-backend-pool-type
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install azdevrequired)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.