Skip to content
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Pending
+++++++
* Remove TrustedAccess commands from aks-preview extension as it is GA and exists in azure-cli for long time.

15.0.0b1
++++++++
* [BREAKING CHANGE] Change `--vm-sizes` for VirtualMachines manual profile to awalys support single SKU size.

14.0.0b7
++++++++
* Add `az aks create/update --enable-retina-flow-logs` and `az aks update --disable-retina-flow-logs` commands.
Expand Down
4 changes: 3 additions & 1 deletion src/aks-preview/azext_aks_preview/agentpool_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,12 +982,14 @@ def set_up_virtual_machines_profile(self, agentpool: AgentPool) -> AgentPool:
return agentpool

sizes = self.context.get_vm_sizes()
if len(sizes) != 1:
raise InvalidArgumentValueError(f"We only accept single sku size for manual profile. {sizes} is invalid.")
count, _, _, _ = self.context.get_node_count_and_enable_cluster_autoscaler_min_max_count()
agentpool.virtual_machines_profile = self.models.VirtualMachinesProfile(
scale=self.models.ScaleProfile(
manual=[
self.models.ManualScaleProfile(
sizes=sizes,
size=sizes[0],
count=count,
)
]
Expand Down
24 changes: 18 additions & 6 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,9 @@ def aks_agentpool_manual_scale_add(cmd,
operation_group="managed_clusters",
)
sizes = [x.strip() for x in vm_sizes.split(",")]
new_manual_scale_profile = ManualScaleProfile(sizes=sizes, count=int(node_count))
if len(sizes) != 1:
raise ClientRequestError("We only accept single sku size for manual profile.")
new_manual_scale_profile = ManualScaleProfile(size=sizes[0], count=int(node_count))
instance.virtual_machines_profile.scale.manual.append(new_manual_scale_profile)

return sdk_no_wait(
Expand Down Expand Up @@ -1715,19 +1717,25 @@ def aks_agentpool_manual_scale_update(cmd, # pylint: disable=unused-argument
raise ClientRequestError("Cannot update manual in a non-virtualmachines node pool.")

_current_vm_sizes = [x.strip() for x in current_vm_sizes.split(",")]
if len(_current_vm_sizes) != 1:
raise InvalidArgumentValueError(
f"We only accept single sku size for manual profile. {current_vm_sizes} is invalid."
)
_vm_sizes = [x.strip() for x in vm_sizes.split(",")] if vm_sizes else []
if len(_vm_sizes) != 1:
raise InvalidArgumentValueError(f"We only accept single sku size for manual profile. {vm_sizes} is invalid.")
manual_exists = False
for m in instance.virtual_machines_profile.scale.manual:
if m.sizes == _current_vm_sizes:
if m.size == _current_vm_sizes[0]:
manual_exists = True
if vm_sizes:
m.sizes = _vm_sizes
m.size = _vm_sizes[0]
if node_count:
m.count = int(node_count)
break
if not manual_exists:
raise InvalidArgumentValueError(
f"Manual with sizes {current_vm_sizes} doesn't exist in node pool {nodepool_name}"
f"Manual with size {current_vm_sizes[0]} doesn't exist in node pool {nodepool_name}"
)

return sdk_no_wait(
Expand All @@ -1751,15 +1759,19 @@ def aks_agentpool_manual_scale_delete(cmd, # pylint: disable=unused-argument
if instance.type_properties_type != CONST_VIRTUAL_MACHINES:
raise CLIError("Cannot delete manual in a non-virtualmachines node pool.")
_current_vm_sizes = [x.strip() for x in current_vm_sizes.split(",")]
if len(_current_vm_sizes) != 1:
raise InvalidArgumentValueError(
f"We only accept single sku size for manual profile. {current_vm_sizes} is invalid."
)
manual_exists = False
for m in instance.virtual_machines_profile.scale.manual:
if m.sizes == _current_vm_sizes:
if m.size == _current_vm_sizes[0]:
manual_exists = True
instance.virtual_machines_profile.scale.manual.remove(m)
break
if not manual_exists:
raise InvalidArgumentValueError(
f"Manual with sizes {current_vm_sizes} doesn't exist in node pool {nodepool_name}"
f"Manual with size {current_vm_sizes[0]} doesn't exist in node pool {nodepool_name}"
)

return sdk_no_wait(
Expand Down
Loading
Loading