Skip to content

Commit 2f7b0ad

Browse files
author
Wen Huang
committed
fix: remove VMSS node-vm-size blocker and add VMs pool test
Address review comments: 1. Remove the InvalidArgumentValueError in update_auto_scaler_properties() that blocked --node-vm-size for VMSS pools. This check was added when --node-vm-size only supported VirtualMachines pools, but now VMSS pools support VM size resize via rolling upgrade. 2. Add test case for VirtualMachines pool to verify update_vm_size() is a no-op (VMs pools handle VM size via the autoscaler update path). 3. Add HISTORY.rst entry for the new feature.
1 parent 05fc657 commit 2f7b0ad

3 files changed

Lines changed: 23 additions & 7 deletions

File tree

src/aks-preview/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ To release a new version, please select a new version number (usually plus 1 to
1111

1212
Pending
1313
+++++++
14+
* `az aks nodepool update`: Support `--node-vm-size` to resize VM size of an existing VMSS-based agent pool (preview). Requires AFEC registration `Microsoft.ContainerService/AgentPoolVMSSResize`.
1415

1516
19.0.0b28
1617
+++++++

src/aks-preview/azext_aks_preview/agentpool_decorator.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,13 +1967,6 @@ def update_auto_scaler_properties(self, agentpool: AgentPool) -> AgentPool:
19671967
if self.context.get_vm_set_type() == CONST_VIRTUAL_MACHINES:
19681968
return agentpool
19691969

1970-
vm_size = self.context.raw_param.get("node_vm_size")
1971-
if vm_size is not None:
1972-
raise InvalidArgumentValueError(
1973-
"--node-vm-size can only be used with virtual machines agentpools. "
1974-
"Updating VM size is not supported for virtual machine scale set agentpools."
1975-
)
1976-
19771970
(
19781971
update_cluster_autoscaler,
19791972
enable_cluster_autoscaler,

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,6 +2691,28 @@ def common_update_vm_size(self):
26912691
)
26922692
self.assertEqual(dec_agentpool_2, ground_truth_agentpool_2)
26932693

2694+
# Test case 3: VirtualMachines pool with node_vm_size provided (should be no-op)
2695+
dec_3 = AKSPreviewAgentPoolUpdateDecorator(
2696+
self.cmd,
2697+
self.client,
2698+
{"node_vm_size": "Standard_D4s_v3"},
2699+
self.resource_type,
2700+
self.agentpool_decorator_mode,
2701+
)
2702+
agentpool_3 = self.create_initialized_agentpool_instance(
2703+
vm_size="Standard_D2s_v3"
2704+
)
2705+
# Set pool type to VirtualMachines - use the correct attribute based on decorator mode
2706+
from azure.cli.command_modules.acs._consts import AgentPoolDecoratorMode
2707+
if self.agentpool_decorator_mode == AgentPoolDecoratorMode.MANAGED_CLUSTER:
2708+
agentpool_3.type = CONST_VIRTUAL_MACHINES
2709+
else:
2710+
agentpool_3.type_properties_type = CONST_VIRTUAL_MACHINES
2711+
dec_3.context.attach_agentpool(agentpool_3)
2712+
dec_agentpool_3 = dec_3.update_vm_size(agentpool_3)
2713+
# vm_size should remain unchanged for VMs pools
2714+
self.assertEqual(dec_agentpool_3.vm_size, "Standard_D2s_v3")
2715+
26942716
def common_update_upgrade_strategy(self):
26952717
# Test case 1: No upgrade strategy provided (should not change agentpool)
26962718
dec_1 = AKSPreviewAgentPoolUpdateDecorator(

0 commit comments

Comments
 (0)