Skip to content

Commit 5bb0454

Browse files
{aks-preview} Add --node-public-ip-prefix-ids to az aks nodepool update (#10420)
* {aks-preview} Add --node-public-ip-prefix-ids to az aks nodepool update Adds the in-place add/replace path for dual-stack node public IP prefixes on an existing node pool. An accepted change rolls the pool so existing nodes are recreated with the new public IPs. Bumps aks-preview to 22.0.0b10. * address PR review: clear legacy singular prefix on update migration; add update-path unit tests; linter exclusions for aks nodepool update * fix linter: merge node_public_ip_prefix_ids exclusion into existing 'aks nodepool update' key The previous commit added a second 'aks nodepool update:' top-level key to linter_exclusions.yml. YAML duplicate keys resolve last-wins, so the existing block (further down the file) silently overrode the new one and dropped the node_public_ip_prefix_ids option_length_too_long exclusion, leaving the HIGH severity linter failure. Merge the parameter exclusion into the existing key and drop the redundant require_wait entry (already covered by the 'aks nodepool' group exclusion).
1 parent 8aa3592 commit 5bb0454

8 files changed

Lines changed: 84 additions & 2 deletions

File tree

‎src/aks-preview/HISTORY.rst‎

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

15+
22.0.0b11
16+
+++++++++
17+
* `az aks nodepool update`: Add `--node-public-ip-prefix-ids` to add or replace the dual-stack node public IP prefixes on an existing node pool. An accepted change rolls the pool so existing nodes are recreated with the new public IPs. Requires the ``NodePublicIPv6PrefixPreview`` feature flag.
18+
1519
22.0.0b10
1620
+++++++++
1721
* Bump API version to 2026-07-02-preview.

‎src/aks-preview/azext_aks_preview/_help.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,6 +2929,10 @@
29292929
- name: --crg-id
29302930
type: string
29312931
short-summary: The Capacity Reservation Group (CRG) ID used to associate the existing nodepool with the existing Capacity Reservation Group resource.
2932+
- name: --node-public-ip-prefix-ids
2933+
type: string
2934+
short-summary: Comma-separated list of public IP prefix resource IDs for dual-stack node public IPs (IPv4 and/or IPv6).
2935+
long-summary: At most one IPv4 and one IPv6 prefix may be specified. On an existing node pool this adds or replaces the assigned prefixes; an accepted change rolls the pool so existing nodes are recreated with the new public IPs. Requires the NodePublicIPv6PrefixPreview feature flag.
29322936
examples:
29332937
- name: Reconcile the nodepool back to its current state.
29342938
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster
@@ -2948,6 +2952,8 @@
29482952
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --zones auto
29492953
- name: Update a node pool with blue-green upgrade settings
29502954
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --drain-batch-size 50% --drain-timeout-bg 5 --batch-soak-duration 10 --final-soak-duration 10
2955+
- name: Add an IPv6 public IP prefix to an existing dual-stack node pool (grows the assigned prefixes; existing nodes are recreated with the new public IPs)
2956+
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --node-public-ip-prefix-ids "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/publicIPPrefixes/<v4prefix>,/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/publicIPPrefixes/<v6prefix>"
29512957
- name: Update a nodepool with a Capacity Reservation Group(CRG) ID.
29522958
text: az aks nodepool update -g MyResourceGroup -n MyNodePool --cluster-name MyMC --node-vm-size VMSize --crg-id "/subscriptions/SubID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/CapacityReservationGroups/MyCRGID"
29532959
"""

‎src/aks-preview/azext_aks_preview/_params.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,6 +2572,15 @@ def load_arguments(self, _):
25722572
)
25732573

25742574
with self.argument_context("aks nodepool update") as c:
2575+
c.argument(
2576+
"node_public_ip_prefix_ids",
2577+
validator=validate_node_public_ip_prefix_ids,
2578+
help="Comma-separated list of public IP prefix resource IDs for dual-stack node public IPs "
2579+
"(IPv4 and/or IPv6). At most one IPv4 and one IPv6 prefix may be specified. "
2580+
"On an existing node pool this adds or replaces the assigned prefixes; an accepted change "
2581+
"rolls the pool so existing nodes are recreated with the new public IPs. "
2582+
"Requires the NodePublicIPv6PrefixPreview feature flag to be registered.",
2583+
)
25752584
c.argument(
25762585
"enable_cluster_autoscaler",
25772586
options_list=["--enable-cluster-autoscaler", "-e"],

‎src/aks-preview/azext_aks_preview/agentpool_decorator.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,10 @@ def update_network_profile(self, agentpool: AgentPool) -> AgentPool:
19761976
asg_ids = self.context.get_asg_ids()
19771977
allowed_host_ports = self.context.get_allowed_host_ports()
19781978
enable_managed_dranet = self.context.get_enable_managed_dranet()
1979-
if not agentpool.network_profile and (asg_ids is not None or allowed_host_ports is not None or enable_managed_dranet):
1979+
node_public_ip_prefix_ids = self.context.get_node_public_ip_prefix_ids()
1980+
if not agentpool.network_profile and (
1981+
asg_ids is not None or allowed_host_ports is not None or enable_managed_dranet or node_public_ip_prefix_ids
1982+
):
19801983
agentpool.network_profile = self.models.AgentPoolNetworkProfile() # pylint: disable=no-member
19811984
if asg_ids is not None:
19821985
agentpool.network_profile.application_security_groups = asg_ids
@@ -1986,6 +1989,10 @@ def update_network_profile(self, agentpool: AgentPool) -> AgentPool:
19861989
agentpool.network_profile.dranet = self.models.DRANETProfile(
19871990
mode="Managed"
19881991
)
1992+
if node_public_ip_prefix_ids:
1993+
agentpool.network_profile.node_public_ip_prefix_i_ds = node_public_ip_prefix_ids
1994+
# the legacy singular field is mutually exclusive with the plural one on PUT; clear it when migrating
1995+
agentpool.node_public_ip_prefix_id = None
19891996
return agentpool
19901997

19911998
def update_gpu_profile(self, agentpool: AgentPool) -> AgentPool:

‎src/aks-preview/azext_aks_preview/custom.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,6 +2403,7 @@ def aks_agentpool_update(
24032403
allowed_host_ports=None,
24042404
asg_ids=None,
24052405
enable_managed_dranet=False,
2406+
node_public_ip_prefix_ids=None,
24062407
enable_artifact_streaming=False,
24072408
disable_artifact_streaming=False,
24082409
enable_managed_gpu=None,

‎src/aks-preview/azext_aks_preview/tests/latest/test_agentpool_decorator.py‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,6 +3134,55 @@ def common_update_managed_dranet(self):
31343134
dec_agentpool_2 = dec_2.update_network_profile(agentpool_2)
31353135
self.assertEqual(dec_agentpool_2.network_profile.dranet.mode, "Managed")
31363136

3137+
def common_update_node_public_ip_prefix_ids(self):
3138+
v4 = "/subscriptions/1234/resourceGroups/rg/providers/Microsoft.Network/publicIPPrefixes/v4"
3139+
v6 = "/subscriptions/1234/resourceGroups/rg/providers/Microsoft.Network/publicIPPrefixes/v6"
3140+
3141+
# migrate a pool created with the legacy singular field: the network profile is created,
3142+
# the plural array is set, and the mutually-exclusive singular field is cleared
3143+
dec_1 = AKSPreviewAgentPoolUpdateDecorator(
3144+
self.cmd,
3145+
self.client,
3146+
{"node_public_ip_prefix_ids": f"{v4},{v6}"},
3147+
self.resource_type,
3148+
self.agentpool_decorator_mode,
3149+
)
3150+
agentpool_1 = self.create_initialized_agentpool_instance(node_public_ip_prefix_id=v4)
3151+
dec_1.context.attach_agentpool(agentpool_1)
3152+
dec_agentpool_1 = dec_1.update_network_profile(agentpool_1)
3153+
self.assertEqual(dec_agentpool_1.network_profile.node_public_ip_prefix_i_ds, [v4, v6])
3154+
self.assertIsNone(dec_agentpool_1.node_public_ip_prefix_id)
3155+
3156+
# replace the prefixes on a pool that already carries the plural array
3157+
dec_2 = AKSPreviewAgentPoolUpdateDecorator(
3158+
self.cmd,
3159+
self.client,
3160+
{"node_public_ip_prefix_ids": f"{v4},{v6}"},
3161+
self.resource_type,
3162+
self.agentpool_decorator_mode,
3163+
)
3164+
agentpool_2 = self.create_initialized_agentpool_instance(
3165+
network_profile=self.models.AgentPoolNetworkProfile(
3166+
node_public_ip_prefix_i_ds=[v4]
3167+
)
3168+
)
3169+
dec_2.context.attach_agentpool(agentpool_2)
3170+
dec_agentpool_2 = dec_2.update_network_profile(agentpool_2)
3171+
self.assertEqual(dec_agentpool_2.network_profile.node_public_ip_prefix_i_ds, [v4, v6])
3172+
3173+
# no prefixes passed: the network profile is left untouched (not created)
3174+
dec_3 = AKSPreviewAgentPoolUpdateDecorator(
3175+
self.cmd,
3176+
self.client,
3177+
{"node_public_ip_prefix_ids": None},
3178+
self.resource_type,
3179+
self.agentpool_decorator_mode,
3180+
)
3181+
agentpool_3 = self.create_initialized_agentpool_instance()
3182+
dec_3.context.attach_agentpool(agentpool_3)
3183+
dec_agentpool_3 = dec_3.update_network_profile(agentpool_3)
3184+
self.assertIsNone(dec_agentpool_3.network_profile)
3185+
31373186
def common_update_managed_gpu(self):
31383187
dec_1 = AKSPreviewAgentPoolUpdateDecorator(
31393188
self.cmd,
@@ -3818,6 +3867,9 @@ def setUp(self):
38183867
def test_update_artifact_streaming(self):
38193868
self.common_update_artifact_streaming()
38203869

3870+
def test_update_node_public_ip_prefix_ids(self):
3871+
self.common_update_node_public_ip_prefix_ids()
3872+
38213873
def test_update_managed_dranet(self):
38223874
self.common_update_managed_dranet()
38233875

‎src/aks-preview/linter_exclusions.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ aks nodepool add:
533533
- option_length_too_long
534534
aks nodepool update:
535535
parameters:
536+
node_public_ip_prefix_ids:
537+
rule_exclusions:
538+
- option_length_too_long
536539
enable_artifact_streaming:
537540
rule_exclusions:
538541
- option_length_too_long

‎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 = "22.0.0b10"
12+
VERSION = "22.0.0b11"
1313

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

0 commit comments

Comments
 (0)