Skip to content

aks-preview: Fix managedNATGatewayV2 outbound type being overwritten to loadBalancer#9748

Open
christine33-creator wants to merge 1 commit intoAzure:mainfrom
christine33-creator:cdossa/fix-natgatewayv2-outbound-type
Open

aks-preview: Fix managedNATGatewayV2 outbound type being overwritten to loadBalancer#9748
christine33-creator wants to merge 1 commit intoAzure:mainfrom
christine33-creator:cdossa/fix-natgatewayv2-outbound-type

Conversation

@christine33-creator
Copy link
Copy Markdown
Contributor

@christine33-creator christine33-creator commented Mar 31, 2026

The dynamic completion logic in _get_outbound_type() did not include managedNATGatewayV2 in its list of known outbound types. When a user specified --outbound-type managedNATGatewayV2, the CLI treated it as an unrecognized value and silently overwrote it to loadBalancer before sending the request to the RP.

Fixed in 3 places:

  • Dynamic completion list: preserve managedNATGatewayV2 instead of overwriting to loadBalancer
  • Basic LB SKU validation: reject managedNATGatewayV2 with basic SKU
  • Multi-zone warning: show zone-redundancy warning for V2 on update

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.

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

azure-client-tools-bot-prd bot commented Mar 31, 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 Mar 31, 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

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>

@christine33-creator christine33-creator changed the title aks-preview: Fix managedNATGatewayV2 outbound type being overwritten … aks-preview: Fix managedNATGatewayV2 outbound type being overwritten to loadBalancer Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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 Mar 31, 2026

Hi @christine33-creator

Release Suggestions

Module: aks-preview

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

Notes

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

Fixes an aks-preview regression where managedNATGatewayV2 was treated as an unknown outbound type during _get_outbound_type() dynamic completion, causing it to be silently overwritten to loadBalancer before the request was sent to the RP.

Changes:

  • Add managedNATGatewayV2 to the “known outbound types” list so it is preserved (not defaulted to loadBalancer) during create-time dynamic completion.
  • Extend outbound-type validation to reject managedNATGatewayV2 when using Basic load balancer SKU.
  • Extend the multi-zone NAT Gateway update warning to also apply to managedNATGatewayV2.

Comment on lines 559 to 565
if (
self.decorator_mode == DecoratorMode.CREATE and
not read_from_mc and
outbound_type not in [
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY,
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY_V2,
CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY,
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

Consider adding/adjusting unit tests to cover the regression fixed here: when the user explicitly sets --outbound-type managedNATGatewayV2, _get_outbound_type() should preserve it (not default to loadBalancer), and enable_validation should reject it when load balancer SKU is basic. There are existing unit tests for _get_outbound_type() but none exercise the V2 outbound type path.

Copilot uses AI. Check for mistakes.
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.

Is there an existing test case that covers this scenario to confirm the fix is correct? If not, please create one and schedule the live test to ensure it works as expected.

@christine33-creator christine33-creator force-pushed the cdossa/fix-natgatewayv2-outbound-type branch from 6aff0ee to 14d28f4 Compare April 1, 2026 02:25
@christine33-creator
Copy link
Copy Markdown
Contributor Author

Is there an existing test case that covers this scenario to confirm the fix is correct? If not, please create one and schedule the live test to ensure it works as expected.

Added a unit test in test_managed_cluster_decorator.py that verifies managedNATGatewayV2 is preserved through the dynamic completion logic instead of being overwritten to loadBalancer.

The test passes locally. A live test cannot pass yet because the RP-side feature toggle is not enabled; the RP currently returns UnsupportedOutboundType across all tested regions (eastus2, westus2, eastus2euap, centraluseuap). We can add/schedule the live test once the RP rollout begins.

@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

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 leave a note about the fix in HISTORY.rst

@christine33-creator christine33-creator force-pushed the cdossa/fix-natgatewayv2-outbound-type branch from 14d28f4 to eb73cb3 Compare April 1, 2026 04:08
@@ -13,6 +13,7 @@ Pending
+++++++
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.

bump the version to 19.0.0b29?

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.

bumped

@christine33-creator christine33-creator force-pushed the cdossa/fix-natgatewayv2-outbound-type branch from eb73cb3 to 3a4a9b0 Compare April 1, 2026 16:14
…to loadBalancer

The dynamic completion logic in _get_outbound_type() did not include
managedNATGatewayV2 in its list of known outbound types. When a user
specified --outbound-type managedNATGatewayV2, the CLI treated it as
an unrecognized value and silently overwrote it to loadBalancer before
sending the request to the RP.

Fixed in 3 places:
- Dynamic completion list: preserve managedNATGatewayV2 instead of
  overwriting to loadBalancer
- Basic LB SKU validation: reject managedNATGatewayV2 with basic SKU
- Multi-zone warning: show zone-redundancy warning for V2 on update
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.

7 participants