Skip to content

Commit 3a4a9b0

Browse files
aks-preview: Fix managedNATGatewayV2 outbound type being overwritten 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
1 parent efcf6e1 commit 3a4a9b0

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

src/aks-preview/HISTORY.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414
* Add MIG (Multi-Instance GPU) strategy option to node pool property in `az aks nodepool add` and `az aks nodepool update`.
15-
* `az aks create/update`: Add `--outbound-type managedNATGatewayV2` support using Azure NAT Gateway Standard V2 SKU with IPv6, user-provided IPs, and IP prefixes.
1615
* Fix monitoring addon key casing compatibility with azure-cli/acs
1716

17+
19.0.0b29
18+
+++++++
19+
* `az aks create/update`: Add `--outbound-type managedNATGatewayV2` support using Azure NAT Gateway Standard V2 SKU with IPv6, user-provided IPs, and IP prefixes.
20+
* `az aks create/update`: Fix `--outbound-type managedNATGatewayV2` being silently overwritten to `loadBalancer` by the dynamic completion logic.
21+
1822
19.0.0b28
1923
+++++++
2024
* Fix `match_condition` kwarg leaking to HTTP transport by overriding `put_mc` and `add_agentpool` to pass `if_match` / `if_none_match` directly to the vendored SDK. This change fixes the compatibility issue as azure-cli/acs module adopts TypeSpec emitted SDKs while azure-cli-extensions/aks-preview still uses the autorest emitted SDK.

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ def _get_outbound_type(
561561
not read_from_mc and
562562
outbound_type not in [
563563
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY,
564+
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY_V2,
564565
CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY,
565566
CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING,
566567
CONST_OUTBOUND_TYPE_NONE,
@@ -580,6 +581,7 @@ def _get_outbound_type(
580581
if outbound_type in [
581582
CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING,
582583
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY,
584+
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY_V2,
583585
CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY,
584586
]:
585587
if safe_lower(self._get_load_balancer_sku(enable_validation=False)) == CONST_LOAD_BALANCER_SKU_BASIC:
@@ -622,7 +624,10 @@ def _get_outbound_type(
622624
a standard load balancer with IP addresses"
623625
)
624626
if self.decorator_mode == DecoratorMode.UPDATE:
625-
if outbound_type == CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY:
627+
if outbound_type in [
628+
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY,
629+
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY_V2,
630+
]:
626631
if self.mc.agent_pool_profiles is not None and len(self.mc.agent_pool_profiles) > 1:
627632
multizoned = False
628633
for ap in self.mc.agent_pool_profiles:

src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
DecoratorEarlyExitException,
103103
DecoratorMode,
104104
)
105+
from azext_aks_preview._consts import (
106+
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY_V2,
107+
)
105108
from dateutil.parser import parse
106109
from deepdiff import DeepDiff
107110

@@ -4686,6 +4689,22 @@ def test_get_outbound_type(self):
46864689
expect_outbound_type_4 = CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY
46874690
self.assertEqual(outbound_type_4,expect_outbound_type_4)
46884691

4692+
# managedNATGatewayV2 should be preserved, not overwritten to loadBalancer
4693+
ctx5 = AKSPreviewManagedClusterContext(
4694+
self.cmd,
4695+
AKSManagedClusterParamDict(
4696+
{"outbound_type": "managedNATGatewayV2"}
4697+
),
4698+
self.models,
4699+
decorator_mode=DecoratorMode.CREATE,
4700+
)
4701+
self.create_attach_agentpool_context(ctx5)
4702+
outbound_type_5 = ctx5._get_outbound_type(False, False, None)
4703+
self.assertEqual(
4704+
outbound_type_5,
4705+
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY_V2,
4706+
)
4707+
46894708
def test_get_enable_gateway_api(self):
46904709
# default value
46914710
ctx_1 = AKSPreviewManagedClusterContext(

0 commit comments

Comments
 (0)