[AKS] Clarify outbound-type update error for managed VNet clusters#33607
[AKS] Clarify outbound-type update error for managed VNet clusters#33607Copilot wants to merge 2 commits into
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @copilot, |
️✔️AzureCLI-BreakingChangeTest
|
Live test results —
|
|
AKS |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR clarifies the validation/error behavior for az aks update --outbound-type userDefinedRouting|userAssignedNATGateway when the target cluster was created with a managed VNet (i.e., not BYO VNet). Instead of emitting a contradictory “missing --vnet-subnet-id” requirement (an argument not accepted on update), update-mode validation now raises a targeted InvalidArgumentValueError explaining that these outbound-type migrations are only supported for BYO VNet clusters and links to the relevant docs.
Changes:
- Extend
_raise_missing_vnet_subnet_for_outbound_type(...)to acceptdecorator_modeand raise an update-specificInvalidArgumentValueErrorfor managed-VNet clusters. - Wire
self.decorator_modeinto the_get_outbound_type(...)validation path. - Add a unit test asserting the new update-mode error message for managed-VNet clusters attempting
userDefinedRouting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py | Adds update-mode-specific outbound-type migration validation and improved error messaging for managed-VNet clusters. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py | Adds focused unit coverage validating the new update-time error behavior/message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related command
az aks update -g <rg> -n <name> --outbound-type userDefinedRoutingDescription
az aks update --outbound-type userDefinedRoutingcould return a contradictory requirement for--vnet-subnet-ideven though that argument is not accepted on update. This PR makes update-time validation explicit: migration touserDefinedRouting/userAssignedNATGatewayis only allowed for clusters created with BYO VNet.Validation path update (AKS managed cluster decorator)
AKSManagedClusterContext._raise_missing_vnet_subnet_for_outbound_type(...)now takesdecorator_mode.DecoratorMode.UPDATE, it raises a targetedInvalidArgumentValueErrorexplaining managed-VNet clusters cannot be updated to those outbound types and points to migration-path docs.Call-site wiring
_get_outbound_type(...)now passesself.decorator_modeinto_raise_missing_vnet_subnet_for_outbound_type(...).Unit coverage
test_get_outbound_typefor update + managed VNet +userDefinedRouting, asserting the new update-specific error text.Testing Guide
N/A (behavioral validation path change with focused existing unit coverage in AKS decorator tests).
History Notes
[AKS]
az aks update: Clarify outbound-type migration error for clusters not created with BYO VNet.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.