{AKS} az aks: add --outbound-type-sku for managed NAT Gateway V2 GA - #34017
{AKS} az aks: add --outbound-type-sku for managed NAT Gateway V2 GA#34017Christine DOSSA (christine33-creator) wants to merge 8 commits into
Conversation
Ports the aks-preview NAT Gateway V2 GA surface (extension PR Azure#10264) into core az aks now that the 2026-06-01 SDK (azure-mgmt-containerservice 41.6.0) is vendored. az aks create / az aks update: add --outbound-type-sku (Standard|StandardV2) to select the managed NAT gateway SKU with --outbound-type managedNATGateway (the GA shape of NAT Gateway V2), plus the StandardV2-only --nat-gateway-managed-outbound-ipv6-count, --nat-gateway-outbound-ips and --nat-gateway-outbound-ip-prefixes. Create requires an explicit --outbound-type managedNATGateway; update verifies the cluster's existing outbound type before applying. Adds builder + validator unit tests.
…io test (record --live)
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution Christine DOSSA (@christine33-creator)! We will review the pull request and get back to you soon. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
…rameter_test_coverage; mark StandardV2 scenario test live-only
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
The current validation/help/model-guarding has correctness and usability gaps (SKU enforcement for V2-only params, missing help entries, and potential None-model call paths) that should be fixed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds GA CLI surface area for AKS managed NAT Gateway V2 by introducing a managed NAT gateway SKU selector and V2-only outbound configuration parameters, wiring them through argument parsing, validation, model-building, and decorator update logic in the acs command module.
Changes:
- Add
--outbound-type-sku {Standard,StandardV2}plus StandardV2-only parameters (--nat-gateway-managed-outbound-ipv6-count,--nat-gateway-outbound-ips,--nat-gateway-outbound-ip-prefixes) toaz aks create/update. - Implement validators and NAT gateway profile building/updating to carry the new SKU and V2 properties.
- Add/extend unit tests and scaffold a live-only scenario test; update HISTORY and linter exclusions.
File summaries
| File | Description |
|---|---|
| src/azure-cli/HISTORY.rst | Release note entry for the new NAT gateway V2 GA CLI surface. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_validators.py | New unit tests covering outbound-type-sku and V2 parameter validators. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_natgateway.py | New unit tests for NAT gateway profile construction/update with SKU and V2 fields. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py | Live-only scenario test scaffold for create/update with managed NAT gateway V2. |
| src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py | Plumbs new args into network profile setup/update; adds model accessors and update-time validation. |
| src/azure-cli/azure/cli/command_modules/acs/linter_exclusions.yml | Suppresses linter “missing parameter test coverage” for the new parameters (draft-oriented). |
| src/azure-cli/azure/cli/command_modules/acs/custom.py | Extends aks_create/aks_update signatures to accept new parameters. |
| src/azure-cli/azure/cli/command_modules/acs/_validators.py | Adds range checks and create/update validation for SKU and V2-only params. |
| src/azure-cli/azure/cli/command_modules/acs/_params.py | Registers new CLI arguments, enums, and validators for create/update. |
| src/azure-cli/azure/cli/command_modules/acs/_natgateway.py | Extends NAT gateway profile building to set SKU, IPv6 count, and BYO outbound IPs/prefixes. |
| src/azure-cli/azure/cli/command_modules/acs/_help.py | Adds help text for --outbound-type-sku (but missing help entries for the other new flags). |
| src/azure-cli/azure/cli/command_modules/acs/_consts.py | Adds constants for managed NAT gateway SKUs. |
Review details
Suppressed comments (3)
src/azure-cli/azure/cli/command_modules/acs/_help.py:877
- The new NAT Gateway V2 parameters (
--nat-gateway-managed-outbound-ipv6-count,--nat-gateway-outbound-ips,--nat-gateway-outbound-ip-prefixes) are not documented in theaz aks updatehelp section here, so users won’t discover them viaaz aks update -h.
- name: --outbound-type-sku
type: string
short-summary: SKU of the managed NAT Gateway (Standard or StandardV2).
long-summary: Only valid with --outbound-type managedNATGateway. Migrate an existing Standard (V1) cluster to StandardV2 by passing StandardV2. StandardV2 adds zone resiliency, IPv6 support, and higher bandwidth. Downgrade from StandardV2 to Standard is not supported.
src/azure-cli/azure/cli/command_modules/acs/linter_exclusions.yml:160
- These new parameters are excluded from
missing_parameter_test_coverage, which will suppress CLI linter coverage checks for the new surface area. Before merging out of draft, consider recording a scenario test for these flags and then removing these exclusions so the linter can enforce coverage going forward.
nat_gateway_sku:
rule_exclusions:
- missing_parameter_test_coverage
nat_gateway_managed_outbound_ipv6_count:
rule_exclusions:
- missing_parameter_test_coverage
nat_gateway_outbound_ip_ids:
rule_exclusions:
- missing_parameter_test_coverage
nat_gateway_outbound_ip_prefix_ids:
rule_exclusions:
- missing_parameter_test_coverage
src/azure-cli/azure/cli/command_modules/acs/_natgateway.py:113
ManagedClusterNATGatewayProfileOutboundIpPrefixesis populated withNonefor backward compatibility when the SDK model isn’t available, but this block unconditionally calls it. If the selected SDK/profile doesn’t include this type, this will fail with aNoneType is not callableerror; raise a clearer error instead.
if outbound_ip_prefix_ids is not None:
ManagedClusterNATGatewayProfileOutboundIpPrefixes = models.ManagedClusterNATGatewayProfileOutboundIpPrefixes
prefix_id_list = [x.strip() for x in outbound_ip_prefix_ids.split(',') if x.strip()]
profile.outbound_ip_prefixes = ManagedClusterNATGatewayProfileOutboundIpPrefixes(
public_ip_prefixes=prefix_id_list
)
- Files reviewed: 12/12 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| nat_gateway_sku: | ||
| rule_exclusions: | ||
| - missing_parameter_test_coverage | ||
| nat_gateway_managed_outbound_ipv6_count: | ||
| rule_exclusions: | ||
| - missing_parameter_test_coverage | ||
| nat_gateway_outbound_ip_ids: | ||
| rule_exclusions: | ||
| - missing_parameter_test_coverage | ||
| nat_gateway_outbound_ip_prefix_ids: | ||
| rule_exclusions: | ||
| - missing_parameter_test_coverage |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Code reviewFound 3 issues:
azure-cli/src/azure-cli/azure/cli/command_modules/acs/_validators.py Lines 422 to 440 in df09593
azure-cli/src/azure-cli/azure/cli/command_modules/acs/_validators.py Lines 359 to 366 in df09593
azure-cli/src/azure-cli/azure/cli/command_modules/acs/_natgateway.py Lines 89 to 98 in df09593 |
…efaults to StandardV2 per GA matrix)
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
…unt range [1,16], and preserve IPv4 default of 1
1: Fixed.
|
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
🤖 PR Validation —⚠️ Review suggested
Summary
Ports the NAT Gateway V2 GA surface to core
az aks, now that the2026-06-01API SDK (azure-mgmt-containerservice41.6.0) is vendored (#34011). Mirrors the aks-preview extension PR Azure/azure-cli-extensions#10264 and follows the AKS NAT Gateway V2 GA API proposal.What
az aks create/az aks update:--outbound-type-sku {Standard,StandardV2}— select the managed NAT gateway SKU with--outbound-type managedNATGateway(the GA shape of NAT Gateway V2).--nat-gateway-managed-outbound-ipv6-count— dual-stack IPv6 outbound IPs (StandardV2 only).--nat-gateway-outbound-ips/--nat-gateway-outbound-ip-prefixes— bring-your-own public IPs / prefixes (StandardV2 only).Validation: create requires an explicit
--outbound-type managedNATGateway; update verifies the cluster's existing outbound type before applying the SKU / V2 params.Testing
test_natgateway.pyandtest_validators.py.azdev style acs: pylint + flake8 pass.test_aks_create_and_update_with_managed_nat_gateway_v2is scaffolded but not yet recorded — needs anazdev test ... --liverun against a StandardV2-capable region. This is why the PR is a draft.History Notes
Added an entry under AKS in
src/azure-cli/HISTORY.rst.