Skip to content

Commit b1ad63b

Browse files
aks-preview: Change NAT gateway V2 outbound IPs/prefixes to comma-separated
Change --nat-gateway-outbound-ips and --nat-gateway-outbound-ip-prefixes from space-separated (nargs='+') to comma-separated string input, matching the existing load balancer outbound IP parameter pattern (--load-balancer-outbound-ips). Before: az aks create --nat-gateway-outbound-ips id1 id2 After: az aks create --nat-gateway-outbound-ips id1,id2
1 parent e60945d commit b1ad63b

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414

15+
19.0.0b30
16+
+++++++
17+
* `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.
18+
1519
19.0.0b29
1620
+++++++
1721
* Add MIG (Multi-Instance GPU) strategy option to node pool property in `az aks nodepool add` and `az aks nodepool update`.
1822
* Fix monitoring addon key casing compatibility with azure-cli/acs
1923
* `az aks create/update`: Add `--outbound-type managedNATGatewayV2` support using Azure NAT Gateway Standard V2 SKU with IPv6, user-provided IPs, and IP prefixes.
2024
* `az aks create/update`: Fix `--outbound-type managedNATGatewayV2` being silently overwritten to `loadBalancer` by the dynamic completion logic.
25+
* `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.
2126

2227
19.0.0b28
2328
+++++++

src/aks-preview/azext_aks_preview/_natgateway.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,16 @@ def configure_nat_gateway_profile(
9191

9292
if outbound_ip_ids is not None:
9393
ManagedClusterNATGatewayProfileOutboundIPs = models.ManagedClusterNATGatewayProfileOutboundIPs
94+
ip_id_list = [x.strip() for x in outbound_ip_ids.split(',')]
9495
profile.outbound_i_ps = ManagedClusterNATGatewayProfileOutboundIPs(
95-
public_i_ps=outbound_ip_ids
96+
public_i_ps=ip_id_list
9697
)
9798

9899
if outbound_ip_prefix_ids is not None:
99100
ManagedClusterNATGatewayProfileOutboundIPPrefixes = models.ManagedClusterNATGatewayProfileOutboundIPPrefixes
101+
prefix_id_list = [x.strip() for x in outbound_ip_prefix_ids.split(',')]
100102
profile.outbound_ip_prefixes = ManagedClusterNATGatewayProfileOutboundIPPrefixes(
101-
public_ip_prefixes=outbound_ip_prefix_ids
103+
public_ip_prefixes=prefix_id_list
102104
)
103105

104106
return profile

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,7 @@ def load_arguments(self, _):
691691
"--nat-gateway-outbound-ips",
692692
"--nat-gw-ips",
693693
],
694-
nargs="+",
695-
help="Space-separated public IP resource IDs for the "
694+
help="Comma-separated public IP resource IDs for the "
696695
"cluster NAT gateway. V2 only.",
697696
)
698697
c.argument(
@@ -701,8 +700,7 @@ def load_arguments(self, _):
701700
"--nat-gateway-outbound-ip-prefixes",
702701
"--nat-gw-prefixes",
703702
],
704-
nargs="+",
705-
help="Space-separated public IP prefix resource IDs "
703+
help="Comma-separated public IP prefix resource IDs "
706704
"for the cluster NAT gateway. V2 only.",
707705
)
708706
c.argument(
@@ -1329,8 +1327,7 @@ def load_arguments(self, _):
13291327
"--nat-gateway-outbound-ips",
13301328
"--nat-gw-ips",
13311329
],
1332-
nargs="+",
1333-
help="Space-separated public IP resource IDs for the "
1330+
help="Comma-separated public IP resource IDs for the "
13341331
"cluster NAT gateway. V2 only.",
13351332
)
13361333
c.argument(
@@ -1339,8 +1336,7 @@ def load_arguments(self, _):
13391336
"--nat-gateway-outbound-ip-prefixes",
13401337
"--nat-gw-prefixes",
13411338
],
1342-
nargs="+",
1343-
help="Space-separated public IP prefix resource IDs "
1339+
help="Comma-separated public IP prefix resource IDs "
13441340
"for the cluster NAT gateway. V2 only.",
13451341
)
13461342
c.argument("network_dataplane", arg_type=get_enum_type(network_dataplanes))

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,24 @@ def test_v2_with_managed_outbound_ipv6_count(self):
122122
self.assertEqual(profile.idle_timeout_in_minutes, 30)
123123

124124
def test_v2_with_outbound_ip_ids(self):
125-
ip_ids = ["/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip1"]
125+
ip_ids = "/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip1"
126126
profile = natgateway.create_nat_gateway_profile(
127127
None, None, models=self.nat_gateway_models,
128128
outbound_ip_ids=ip_ids,
129129
)
130130
self.assertIsNotNone(profile)
131131
self.assertEqual(len(profile.outbound_i_ps.public_i_ps), 1)
132-
self.assertEqual(profile.outbound_i_ps.public_i_ps[0], ip_ids[0])
132+
self.assertEqual(profile.outbound_i_ps.public_i_ps[0], ip_ids)
133133

134134
def test_v2_with_outbound_ip_prefix_ids(self):
135-
prefix_ids = ["/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/prefix1"]
135+
prefix_ids = "/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/prefix1"
136136
profile = natgateway.create_nat_gateway_profile(
137137
None, None, models=self.nat_gateway_models,
138138
outbound_ip_prefix_ids=prefix_ids,
139139
)
140140
self.assertIsNotNone(profile)
141141
self.assertEqual(len(profile.outbound_ip_prefixes.public_ip_prefixes), 1)
142-
self.assertEqual(profile.outbound_ip_prefixes.public_ip_prefixes[0], prefix_ids[0])
142+
self.assertEqual(profile.outbound_ip_prefixes.public_ip_prefixes[0], prefix_ids)
143143

144144
def test_v2_only_ipv6_count(self):
145145
profile = natgateway.create_nat_gateway_profile(
@@ -171,7 +171,7 @@ def test_v2_update_with_ipv6_count(self):
171171

172172
def test_v2_update_with_outbound_ip_ids(self):
173173
origin_profile = self.nat_gateway_models.ManagedClusterNATGatewayProfile(idle_timeout_in_minutes=4)
174-
ip_ids = ["/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip1"]
174+
ip_ids = "/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip1"
175175
profile = natgateway.update_nat_gateway_profile(
176176
None, None, origin_profile, models=self.nat_gateway_models,
177177
outbound_ip_ids=ip_ids,
@@ -196,11 +196,11 @@ def test_only_ipv6_count(self):
196196
self.assertTrue(result)
197197

198198
def test_only_outbound_ip_ids(self):
199-
result = natgateway.is_nat_gateway_profile_provided(None, None, outbound_ip_ids=["/sub/ip1"])
199+
result = natgateway.is_nat_gateway_profile_provided(None, None, outbound_ip_ids="/sub/ip1")
200200
self.assertTrue(result)
201201

202202
def test_only_outbound_ip_prefix_ids(self):
203-
result = natgateway.is_nat_gateway_profile_provided(None, None, outbound_ip_prefix_ids=["/sub/prefix1"])
203+
result = natgateway.is_nat_gateway_profile_provided(None, None, outbound_ip_prefix_ids="/sub/prefix1")
204204
self.assertTrue(result)
205205

206206
def test_all_none(self):

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.0b29"
12+
VERSION = "19.0.0b30"
1313

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

0 commit comments

Comments
 (0)