Skip to content

{AKS} aks-preview: add --outbound-type-sku for managed NAT Gateway V2 GA - #10264

Open
Christine DOSSA (christine33-creator) wants to merge 7 commits into
Azure:mainfrom
christine33-creator:cdossa/natgwv2-ga-cli-sku
Open

{AKS} aks-preview: add --outbound-type-sku for managed NAT Gateway V2 GA#10264
Christine DOSSA (christine33-creator) wants to merge 7 commits into
Azure:mainfrom
christine33-creator:cdossa/natgwv2-ga-cli-sku

Conversation

@christine33-creator

@christine33-creator Christine DOSSA (christine33-creator) commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes
⚠️ None
⚠️Azure CLI Extensions Breaking Change Test
⚠️aks-preview
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd aks create cmd aks create added parameter nat_gateway_sku
⚠️ 1006 - ParaAdd aks update cmd aks update added parameter nat_gateway_sku

Related command

az aks create / az aks update (--outbound-type-sku)


Add --outbound-type-sku {Standard,StandardV2} on az aks create and az aks update to select the managed NAT gateway SKU for --outbound-type managedNATGateway — the GA shape of NAT Gateway V2 (natGatewayProfile.sku), matching the GA CLI proposal.

Uses the 2026-06-02-preview SDK vendored in #10251.

Changes

  • _consts/_params: --outbound-type-sku {Standard,StandardV2} enum + help on create and update.
  • _validators: validate_outbound_type_sku and validate_nat_gateway_v2_params accept only --outbound-type managedNATGateway (the vendored 2026-06-02-preview SDK drops the legacy managedNATGatewayV2 from OutboundType, so the RP rejects it on this API version).
  • _natgateway/decorator/custom: thread nat_gateway_sku through the profile builder and create/update decorators, setting natGatewayProfile.sku.
  • Unit tests, _help.py examples, HISTORY.rst entry.

Testing

  • Unit: pytest azext_aks_preview/tests/latest/test_natgateway.py → 37 passed. flake8 + pylint --errors-only clean on changed files.
  • Scenario/live replay recordings: pending RP-side GA deployment that serves natGatewayProfile.sku.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (validated with flake8 + pylint directly; azdev env not configured in this workspace)
  • Have you run python scripts/ci/test_index.py -q locally?
  • My extension version conforms to the Extension version schema (added to HISTORY.rst Pending; no version bump — repo currently in accumulate mode)

Add --outbound-type-sku (alias --nat-gateway-sku) on `az aks create` and
`az aks update` to select the managed NAT gateway SKU (Standard or StandardV2)
with --outbound-type managedNATGateway - the GA shape of NAT Gateway V2
(natGatewayProfile.sku).

- _consts/_params: --outbound-type-sku {Standard,StandardV2} enum + help on
  create and update.
- _validators: validate_outbound_type_sku (SKU only valid with the managed NAT
  gateway outbound type); validate_nat_gateway_v2_params now accepts the GA
  managedNATGateway outbound type in addition to legacy managedNATGatewayV2.
- _natgateway/decorator/custom: thread nat_gateway_sku through the profile
  builder and the create/update decorators, setting natGatewayProfile.sku.
- Unit tests for the builder, is-provided, and both validators; help + HISTORY.

Uses the 2026-06-02-preview SDK (natGatewayProfile.sku) vendored in
Azure#10251.
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Christine DOSSA (@christine33-creator),
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

@christine33-creator
Christine DOSSA (christine33-creator) marked this pull request as ready for review August 27, 2026 18:40
Copilot AI lite review requested due to automatic review settings August 27, 2026 18:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a GA-friendly way to select the managed NAT Gateway V2 shape for AKS by introducing --outbound-type-sku {Standard,StandardV2} on az aks create and az aks update, and wiring it through to natGatewayProfile.sku while keeping legacy managedNATGatewayV2 support.

Changes:

  • Add --outbound-type-sku argument (enum) and thread nat_gateway_sku through create/update decorators into natGatewayProfile.sku.
  • Update validation to allow V2-only NAT gateway params with managedNATGateway (GA shape) and legacy managedNATGatewayV2.
  • Add/extend unit tests, update help examples, and document the feature in HISTORY.rst.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/aks-preview/HISTORY.rst Documents the new --outbound-type-sku option in release notes.
src/aks-preview/azext_aks_preview/tests/latest/test_natgateway.py Adds unit tests for SKU propagation and validator behavior.
src/aks-preview/azext_aks_preview/managed_cluster_decorator.py Threads nat_gateway_sku into network profile NAT gateway profile creation/update.
src/aks-preview/azext_aks_preview/custom.py Adds nat_gateway_sku to aks_create/aks_update signatures so it flows into raw parameters.
src/aks-preview/azext_aks_preview/_validators.py Updates V2-param validator to allow managedNATGateway and adds validate_outbound_type_sku.
src/aks-preview/azext_aks_preview/_params.py Registers --outbound-type-sku argument and hooks up the validator for create/update.
src/aks-preview/azext_aks_preview/_natgateway.py Adds nat_gateway_sku plumbing and sets profile.sku.
src/aks-preview/azext_aks_preview/_help.py Adds help entries for --outbound-type-sku on create/update.
src/aks-preview/azext_aks_preview/_consts.py Introduces constants for NAT gateway SKUs.
Suppressed comments (2)

src/aks-preview/azext_aks_preview/_params.py:1547

  • Same as above: the update-command help text for --outbound-type-sku currently claims it is only valid with --outbound-type managedNATGateway, but the validator supports legacy managedNATGatewayV2 and update scenarios where --outbound-type is omitted. Aligning the help avoids conflicting guidance.
            help="SKU of the managed NAT Gateway: Standard or StandardV2. Only valid with "
                 "--outbound-type managedNATGateway. Omit to default to StandardV2 where the "
                 "region supports it.",

src/aks-preview/azext_aks_preview/_help.py:1051

  • Same as above for az aks update: the --outbound-type-sku long-summary claims it's only valid with managedNATGateway, but the code supports legacy managedNATGatewayV2 as well. Aligning these docs avoids user confusion.
        - 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. StandardV2 selects the NAT Gateway V2 shape, which supports IPv6, user-provided public IPs, and user-provided IP prefixes. If omitted, defaults to StandardV2 where the region supports it, otherwise Standard.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/aks-preview/azext_aks_preview/_validators.py Outdated
Comment thread src/aks-preview/azext_aks_preview/_validators.py
Comment thread src/aks-preview/azext_aks_preview/_params.py
Comment thread src/aks-preview/azext_aks_preview/_help.py
Comment thread src/aks-preview/azext_aks_preview/tests/latest/test_natgateway.py
The vendored 2026-06-02-preview SDK drops managedNATGatewayV2 from OutboundType, so the RP rejects it on this API version. validate_outbound_type_sku and validate_nat_gateway_v2_params now accept only --outbound-type managedNATGateway (the GA shape). Addresses Copilot review comments on help/behavior mismatch. Flips the two tests that asserted managedNATGatewayV2 acceptance.
@yonzhan

Copy link
Copy Markdown
Collaborator

AKS

@FumingZhang FumingZhang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a new scenario test, or update an existing one, to help confirm the change is working as expected.

Comment thread src/aks-preview/azext_aks_preview/_validators.py Outdated
Comment thread src/aks-preview/azext_aks_preview/_validators.py
sku = getattr(namespace, 'nat_gateway_sku', None)
if sku is None:
return
outbound_type = getattr(namespace, 'outbound_type', None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

az aks create --outbound-type-sku StandardV2 is accepted when --outbound-type is omitted. Create then defaults to loadBalancer while the new decorator builds a NAT gateway profile, so the command sends an incompatible request shape; omission should only be allowed for update.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Split the validator: on create, --outbound-type-sku now requires an explicit --outbound-type managedNATGateway; a new validate_outbound_type_sku_for_update preserves omission on update where the cluster is already managed NAT gateway.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The create case is fixed, but the update path still permits this flag for any existing outbound type. For example, on a loadBalancer cluster, az aks update --outbound-type-sku StandardV2 passes because the raw outbound_type is None; update_nat_gateway_profile then creates a NAT gateway profile while the cluster remains loadBalancer, producing the same incompatible request shape. Please validate the existing mc.network_profile.outbound_type in the update decorator (or otherwise reject unless the effective outbound type is managedNATGateway).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the update decorator. update_nat_gateway_profile now resolves the effective outbound type (the request's --outbound-type if given, otherwise the cluster's existing mc.network_profile.outbound_type) and raises InvalidArgumentValueError if --outbound-type-sku (or any V2 param) is supplied while that effective type isn't managedNATGateway.

…cit outbound-type on create, add scenario test

- validate_nat_gateway_v2_params: reject Standard SKU with V2-only params and clarify the error to require both --outbound-type managedNATGateway and --outbound-type-sku StandardV2 (Fuming comments 1-2).
- validate_outbound_type_sku: on create require --outbound-type managedNATGateway explicitly; add validate_outbound_type_sku_for_update so update may omit it (Fuming comment 3).
- Add live_only scenario test test_aks_create_and_update_with_managed_nat_gateway_standardv2 and update unit tests.
return
outbound_type = getattr(namespace, 'outbound_type', None)
sku = getattr(namespace, 'nat_gateway_sku', None)
if (outbound_type is not None and outbound_type != 'managedNATGateway') or sku == 'Standard':

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validator is registered for both create and update, so treating outbound_type=None as an update also leaves create unguarded. az aks create --nat-gateway-managed-outbound-ipv6-count 1 ... (or either BYO V2 parameter) can omit --outbound-type, pass this validator, and then build a NAT gateway profile while create defaults to loadBalancer. Please split the V2-parameter validation by operation as was done for the SKU, requiring an explicit managedNATGateway on create while allowing omission only after update verifies the existing cluster type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Split the V2-parameter validation by operation, mirroring the SKU. validate_nat_gateway_v2_params now requires an explicit --outbound-type managedNATGateway on create (so az aks create --nat-gateway-managed-outbound-ipv6-count 1 without --outbound-type is rejected instead of building a NAT gateway profile on a loadBalancer default). A new validate_nat_gateway_v2_params_for_update permits omission on update, and the update decorator then verifies the existing cluster type (same guard as the SKU). Added TestValidateNatGatewayV2ParamsForUpdate and updated the create test to expect rejection.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No additional findings from my side. The concerns I identified are already covered by Fuming’s existing review comments, so I’ll defer approval until those threads are resolved.

…ve outbound type

Addresses review: the V2-param validator was shared by create and update and treated outbound_type=None as update, leaving create unguarded (e.g. 'az aks create --nat-gateway-managed-outbound-ipv6-count 1' without --outbound-type defaulted to loadBalancer while building a NAT gateway profile). Split it like the SKU validator: validate_nat_gateway_v2_params now requires an explicit --outbound-type managedNATGateway on create, and a new validate_nat_gateway_v2_params_for_update allows omission on update.

The update path also permitted --outbound-type-sku / V2 params on any existing outbound type: on a loadBalancer cluster the flags were silently dropped (profile cleared) instead of erroring. update_nat_gateway_profile now rejects the SKU and V2 params unless the cluster's effective (resolved) outbound type is managedNATGateway. Adds unit tests for the create/update validators and the decorator guard.
…li-sku

# Conflicts:
#	src/aks-preview/HISTORY.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad AKS Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants