Skip to content

aks-preview: Fix V2 NAT gateway params rejected on update without --outbound-type#9769

Open
christine33-creator wants to merge 2 commits intoAzure:mainfrom
christine33-creator:cdossa/fix-natgwv2-validator-update
Open

aks-preview: Fix V2 NAT gateway params rejected on update without --outbound-type#9769
christine33-creator wants to merge 2 commits intoAzure:mainfrom
christine33-creator:cdossa/fix-natgwv2-validator-update

Conversation

@christine33-creator
Copy link
Copy Markdown
Contributor

The validate_nat_gateway_v2_params validator required --outbound-type managedNATGatewayV2 to be explicitly passed even on updates where the cluster is already V2. Users had to re-specify --outbound-type on every update that used V2-only params like --nat-gateway-managed-outbound-ipv6-count.

Fix: Only reject V2 params when --outbound-type is explicitly set to a non-V2 value. When --outbound-type is not specified (None), allow the request through and let the RP validate.


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

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.json automatically.
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.

…utbound-type

The validate_nat_gateway_v2_params validator required --outbound-type
managedNATGatewayV2 to be explicitly passed even on updates where the
cluster is already V2. Users had to re-specify --outbound-type on every
update that used V2-only params like --nat-gateway-managed-outbound-ipv6-count.

Fix: Only reject V2 params when --outbound-type is explicitly set to a
non-V2 value. When --outbound-type is not specified (None), allow the
request through and let the RP validate.
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Apr 8, 2026

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @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 setup.py as well.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 8, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

CodeGen Tools Feedback Collection

Thank 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Hi @christine33-creator

Release Suggestions

Module: aks-preview

  • Update VERSION to 19.0.0b30 in src/aks-preview/setup.py

Notes

@christine33-creator christine33-creator marked this pull request as ready for review April 8, 2026 21:50
Copilot AI review requested due to automatic review settings April 8, 2026 21:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adjusts the NAT Gateway V2 cross-parameter validation so AKS updates on already-V2 clusters don’t require re-specifying --outbound-type, while still preventing V2-only parameters from being used with explicitly non-V2 outbound types.

Changes:

  • Relax validate_nat_gateway_v2_params to only reject V2-only params when --outbound-type is explicitly set and non-V2.
  • Add unit tests covering allowed/rejected combinations for V2-only params vs outbound type.
  • Document the behavior change in HISTORY.rst.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/aks-preview/azext_aks_preview/_validators.py Updates the validator logic and clarifies behavior in the docstring.
src/aks-preview/azext_aks_preview/tests/latest/test_natgateway.py Adds unit tests for the updated validator behavior.
src/aks-preview/HISTORY.rst Notes the fix in the changelog.

Comment on lines +241 to +248
def _make_namespace(self, **kwargs):
from types import SimpleNamespace
defaults = {
'nat_gateway_managed_outbound_ipv6_count': None,
'nat_gateway_outbound_ip_ids': None,
'nat_gateway_outbound_ip_prefix_ids': None,
'outbound_type': None,
}
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

Given the validator likely sees list-typed args from CLI parsing, add test cases where nat_gateway_outbound_ip_ids / nat_gateway_outbound_ip_prefix_ids are empty lists (and possibly empty strings) to ensure they are not treated as “set” and do not trigger the V2-only validation accidentally.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

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

lgtm, please resolve comments about history notes

20.0.0b1
+++++++
* [Breaking Change] `az aks create/update`: Change `--nat-gateway-outbound-ips` and `--nat-gateway-outbound-ip-prefixes` to use comma-separated values, consistent with load balancer outbound IP parameters.
* `az aks update`: Fix V2-only NAT gateway params (e.g. `--nat-gateway-managed-outbound-ipv6-count`) being rejected on update when `--outbound-type` is not re-specified for an already-V2 cluster.
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 version or move this to the Pending section. Do not append changes to a released version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants