Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ To release a new version, please select a new version number (usually plus 1 to
Pending
+++++++

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.

19.0.0b30
+++++++
* Add option `AzureContainerLinux` to `--os-sku` for `az aks create`, `az aks nodepool add`, and `az aks nodepool update`.
Expand Down
6 changes: 4 additions & 2 deletions src/aks-preview/azext_aks_preview/_natgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,16 @@ def configure_nat_gateway_profile(

if outbound_ip_ids is not None:
ManagedClusterNATGatewayProfileOutboundIPs = models.ManagedClusterNATGatewayProfileOutboundIPs
ip_id_list = [x.strip() for x in outbound_ip_ids.split(',') if x.strip()]
profile.outbound_i_ps = ManagedClusterNATGatewayProfileOutboundIPs(
public_i_ps=outbound_ip_ids
public_i_ps=ip_id_list
)

if outbound_ip_prefix_ids is not None:
ManagedClusterNATGatewayProfileOutboundIPPrefixes = models.ManagedClusterNATGatewayProfileOutboundIPPrefixes
prefix_id_list = [x.strip() for x in outbound_ip_prefix_ids.split(',') if x.strip()]
profile.outbound_ip_prefixes = ManagedClusterNATGatewayProfileOutboundIPPrefixes(
public_ip_prefixes=outbound_ip_prefix_ids
public_ip_prefixes=prefix_id_list
)

return profile
12 changes: 4 additions & 8 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,7 @@ def load_arguments(self, _):
"--nat-gateway-outbound-ips",
"--nat-gw-ips",
],
nargs="+",
help="Space-separated public IP resource IDs for the "
help="Comma-separated public IP resource IDs for the "
"cluster NAT gateway. V2 only.",
)
c.argument(
Expand All @@ -704,8 +703,7 @@ def load_arguments(self, _):
"--nat-gateway-outbound-ip-prefixes",
"--nat-gw-prefixes",
],
nargs="+",
help="Space-separated public IP prefix resource IDs "
help="Comma-separated public IP prefix resource IDs "
"for the cluster NAT gateway. V2 only.",
)
c.argument(
Expand Down Expand Up @@ -1332,8 +1330,7 @@ def load_arguments(self, _):
"--nat-gateway-outbound-ips",
"--nat-gw-ips",
],
nargs="+",
help="Space-separated public IP resource IDs for the "
help="Comma-separated public IP resource IDs for the "
"cluster NAT gateway. V2 only.",
)
c.argument(
Expand All @@ -1342,8 +1339,7 @@ def load_arguments(self, _):
"--nat-gateway-outbound-ip-prefixes",
"--nat-gw-prefixes",
],
nargs="+",
help="Space-separated public IP prefix resource IDs "
help="Comma-separated public IP prefix resource IDs "
"for the cluster NAT gateway. V2 only.",
)
c.argument("network_dataplane", arg_type=get_enum_type(network_dataplanes))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,51 @@ def test_v2_with_managed_outbound_ipv6_count(self):
self.assertEqual(profile.idle_timeout_in_minutes, 30)

def test_v2_with_outbound_ip_ids(self):
ip_ids = ["/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip1"]
ip_ids = "/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip1"
profile = natgateway.create_nat_gateway_profile(
None, None, models=self.nat_gateway_models,
outbound_ip_ids=ip_ids,
)
self.assertIsNotNone(profile)
self.assertEqual(len(profile.outbound_i_ps.public_i_ps), 1)
self.assertEqual(profile.outbound_i_ps.public_i_ps[0], ip_ids[0])
self.assertEqual(profile.outbound_i_ps.public_i_ps[0], ip_ids)

def test_v2_with_multiple_outbound_ip_ids(self):
ip_ids = "/sub/rg/ip1,/sub/rg/ip2"
profile = natgateway.create_nat_gateway_profile(
None, None, models=self.nat_gateway_models,
outbound_ip_ids=ip_ids,
)
self.assertEqual(len(profile.outbound_i_ps.public_i_ps), 2)
self.assertEqual(profile.outbound_i_ps.public_i_ps[0], "/sub/rg/ip1")
self.assertEqual(profile.outbound_i_ps.public_i_ps[1], "/sub/rg/ip2")

def test_v2_with_outbound_ip_ids_whitespace(self):
ip_ids = "/sub/rg/ip1, /sub/rg/ip2"
profile = natgateway.create_nat_gateway_profile(
None, None, models=self.nat_gateway_models,
outbound_ip_ids=ip_ids,
)
self.assertEqual(len(profile.outbound_i_ps.public_i_ps), 2)
self.assertEqual(profile.outbound_i_ps.public_i_ps[1], "/sub/rg/ip2")

def test_v2_with_outbound_ip_ids_trailing_comma(self):
ip_ids = "/sub/rg/ip1,"
profile = natgateway.create_nat_gateway_profile(
None, None, models=self.nat_gateway_models,
outbound_ip_ids=ip_ids,
)
self.assertEqual(len(profile.outbound_i_ps.public_i_ps), 1)

def test_v2_with_outbound_ip_prefix_ids(self):
prefix_ids = ["/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/prefix1"]
prefix_ids = "/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/prefix1"
profile = natgateway.create_nat_gateway_profile(
None, None, models=self.nat_gateway_models,
outbound_ip_prefix_ids=prefix_ids,
)
self.assertIsNotNone(profile)
self.assertEqual(len(profile.outbound_ip_prefixes.public_ip_prefixes), 1)
self.assertEqual(profile.outbound_ip_prefixes.public_ip_prefixes[0], prefix_ids[0])
self.assertEqual(profile.outbound_ip_prefixes.public_ip_prefixes[0], prefix_ids)

def test_v2_only_ipv6_count(self):
profile = natgateway.create_nat_gateway_profile(
Expand Down Expand Up @@ -171,7 +198,7 @@ def test_v2_update_with_ipv6_count(self):

def test_v2_update_with_outbound_ip_ids(self):
origin_profile = self.nat_gateway_models.ManagedClusterNATGatewayProfile(idle_timeout_in_minutes=4)
ip_ids = ["/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip1"]
ip_ids = "/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/ip1"
profile = natgateway.update_nat_gateway_profile(
None, None, origin_profile, models=self.nat_gateway_models,
outbound_ip_ids=ip_ids,
Expand All @@ -196,11 +223,11 @@ def test_only_ipv6_count(self):
self.assertTrue(result)

def test_only_outbound_ip_ids(self):
result = natgateway.is_nat_gateway_profile_provided(None, None, outbound_ip_ids=["/sub/ip1"])
result = natgateway.is_nat_gateway_profile_provided(None, None, outbound_ip_ids="/sub/ip1")
self.assertTrue(result)

def test_only_outbound_ip_prefix_ids(self):
result = natgateway.is_nat_gateway_profile_provided(None, None, outbound_ip_prefix_ids=["/sub/prefix1"])
result = natgateway.is_nat_gateway_profile_provided(None, None, outbound_ip_prefix_ids="/sub/prefix1")
self.assertTrue(result)

def test_all_none(self):
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from setuptools import find_packages, setup

VERSION = "19.0.0b30"
VERSION = "20.0.0b1"

CLASSIFIERS = [
"Development Status :: 4 - Beta",
Expand Down
Loading