Skip to content

Commit 1553d5b

Browse files
aks-preview: Fix managedNATGatewayV2 outbound type being overwritten to loadBalancer (#9748)
1 parent 49c2ee4 commit 1553d5b

4 files changed

Lines changed: 31 additions & 3 deletions

File tree

src/aks-preview/HISTORY.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ To release a new version, please select a new version number (usually plus 1 to
1111

1212
Pending
1313
+++++++
14+
15+
19.0.0b29
16+
+++++++
1417
* 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.
1618
* Fix monitoring addon key casing compatibility with azure-cli/acs
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.
1721

1822
19.0.0b28
1923
+++++++

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(

src/aks-preview/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from setuptools import find_packages, setup
1111

12-
VERSION = "19.0.0b28"
12+
VERSION = "19.0.0b29"
1313

1414
CLASSIFIERS = [
1515
"Development Status :: 4 - Beta",

0 commit comments

Comments
 (0)