Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ If there is no rush to release a new version, please just add a description of t

To release a new version, please select a new version number (usually plus 1 to last patch version, X.Y.Z -> Major.Minor.Patch, more details in `\doc <https://semver.org/>`_), and then add a new section named as the new version number in this file, the content should include the new modifications and everything from the *Pending* section. Finally, update the `VERSION` variable in `setup.py` with this new version number.

Pending
20.0.0b7
+++++++
* `az aks nodepool update --crg-id`: Allow updating `--crg-id` to associate an existing Capacity Reservation Group with a nodepool not currently associated with one.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please include the changelogs which are under Pending section into the latest version

* Update the minimum required cli core version to `2.76.0` (actually since `20.0.0b3`).
* `az aks upgrade`: Add `--k8s-support-plan` and `--tier` flag support to allow cluster support plan and tier configuration during cluster upgrade.

Expand Down
5 changes: 5 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -2521,6 +2521,9 @@
- name: --gpu-driver
type: string
short-summary: Whether to install driver for GPU node pool. Possible values are "Install" or "None".
- name: --crg-id
type: string
short-summary: The Capacity Reservation Group (CRG) ID used to associate the existing nodepool with the existing Capacity Reservation Group resource.
examples:
- name: Reconcile the nodepool back to its current state.
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster
Expand All @@ -2538,6 +2541,8 @@
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --node-vm-size Standard_D4s_v3
- name: Update a node pool with blue-green upgrade settings
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
- name: Update a nodepool with a Capacity Reservation Group(CRG) ID.
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"
"""

helps['aks nodepool get-upgrades'] = """
Expand Down
1 change: 1 addition & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,7 @@ def load_arguments(self, _):
c.argument("mode", arg_type=get_enum_type(node_mode_types))
c.argument("scale_down_mode", arg_type=get_enum_type(scale_down_modes))
# extensions
c.argument("crg_id", validator=validate_crg_id, is_preview=True)
c.argument(
"allowed_host_ports", validator=validate_allowed_host_ports, is_preview=True
)
Expand Down
18 changes: 17 additions & 1 deletion src/aks-preview/azext_aks_preview/agentpool_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,9 @@ def set_up_preview_vm_properties(self, agentpool: AgentPool) -> AgentPool:
"""
self._ensure_agentpool(agentpool)

agentpool.capacity_reservation_group_id = self.context.get_crg_id()
crg_id = self.context.get_crg_id()
if crg_id is not None:
agentpool.capacity_reservation_group_id = crg_id
return agentpool

def set_up_motd(self, agentpool: AgentPool) -> AgentPool:
Expand Down Expand Up @@ -1944,6 +1946,17 @@ def update_fips_image(self, agentpool: AgentPool) -> AgentPool:

return agentpool

def update_crg(self, agentpool: AgentPool) -> AgentPool:
"""Update crg id for the AgentPool object.
:return: the AgentPool object
"""
self._ensure_agentpool(agentpool)

crg_id = self.context.get_crg_id()
if crg_id is not None:
agentpool.capacity_reservation_group_id = crg_id
return agentpool

def update_vm_size(self, agentpool: AgentPool) -> AgentPool:
"""Update VM size for the AgentPool object.

Expand Down Expand Up @@ -2051,6 +2064,9 @@ def update_agentpool_profile_preview(self, agentpools: List[AgentPool] = None) -
# update gpu mig strategy
agentpool = self.update_gpu_mig_strategy(agentpool)

# update crg id
agentpool = self.update_crg(agentpool)

Comment thread
zjpjack-github marked this conversation as resolved.
return agentpool

def update_auto_scaler_properties(self, agentpool: AgentPool) -> AgentPool:
Expand Down
2 changes: 2 additions & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2068,6 +2068,8 @@ def aks_agentpool_update(
node_vm_size=None,
gpu_driver=None,
gpu_mig_strategy=None,
# crg
crg_id=None,
):
# DO NOT MOVE: get all the original parameters and save them as a dictionary
raw_parameters = locals()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def test_update_agentpool_profile_preview_default_behavior(self):
decorator.update_blue_green_upgrade_settings = Mock(return_value=agentpool)
decorator.update_gpu_profile = Mock(return_value=agentpool)
decorator.update_gpu_mig_strategy = Mock(return_value=agentpool)
decorator.update_crg = Mock(return_value=agentpool)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR only adds unit tests. Is it possible to add scenario test to verify your change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

synced offline about the scenario test. It is a bit hard for crg related because we need to setup some extra steps for role assignment and create CRG. cx is waiting for this to temporarily unblock them


# Act
result = decorator.update_agentpool_profile_preview()
Expand All @@ -162,6 +163,7 @@ def test_update_agentpool_profile_preview_default_behavior(self):
decorator.update_blue_green_upgrade_settings.assert_called_once_with(agentpool)
decorator.update_gpu_profile.assert_called_once_with(agentpool)
decorator.update_gpu_mig_strategy.assert_called_once_with(agentpool)
decorator.update_crg.assert_called_once_with(agentpool)

def test_update_agentpool_profile_preview_with_agentpools_parameter(self):
"""Test update_agentpool_profile_preview with agentpools parameter."""
Expand Down Expand Up @@ -206,6 +208,7 @@ def test_update_agentpool_profile_preview_with_agentpools_parameter(self):
decorator.update_blue_green_upgrade_settings = Mock(return_value=agentpool)
decorator.update_gpu_profile = Mock(return_value=agentpool)
decorator.update_gpu_mig_strategy = Mock(return_value=agentpool)
decorator.update_crg = Mock(return_value=agentpool)

# Act
result = decorator.update_agentpool_profile_preview(agentpools)
Expand Down Expand Up @@ -258,6 +261,8 @@ def test_update_agentpool_profile_preview_managed_system_mode(self):
decorator.update_upgrade_strategy = Mock()
decorator.update_blue_green_upgrade_settings = Mock()
decorator.update_gpu_profile = Mock()
decorator.update_gpu_mig_strategy = Mock()
decorator.update_crg = Mock()

# Act
result = decorator.update_agentpool_profile_preview()
Expand Down Expand Up @@ -288,6 +293,8 @@ def test_update_agentpool_profile_preview_managed_system_mode(self):
decorator.update_upgrade_strategy.assert_not_called()
decorator.update_blue_green_upgrade_settings.assert_not_called()
decorator.update_gpu_profile.assert_not_called()
decorator.update_gpu_mig_strategy.assert_not_called()
decorator.update_crg.assert_not_called()

def test_update_agentpool_profile_preview_managed_system_mode_with_agentpools(self):
"""Test update_agentpool_profile_preview with ManagedSystem mode and agentpools parameter."""
Expand Down Expand Up @@ -369,6 +376,7 @@ def test_update_agentpool_profile_preview_system_mode_regular_flow(self):
decorator.update_blue_green_upgrade_settings = Mock(return_value=agentpool)
decorator.update_gpu_profile = Mock(return_value=agentpool)
decorator.update_gpu_mig_strategy = Mock(return_value=agentpool)
decorator.update_crg = Mock(return_value=agentpool)

# Act
result = decorator.update_agentpool_profile_preview()
Expand All @@ -393,6 +401,7 @@ def test_update_agentpool_profile_preview_system_mode_regular_flow(self):
decorator.update_blue_green_upgrade_settings.assert_called_once_with(agentpool)
decorator.update_gpu_profile.assert_called_once_with(agentpool)
decorator.update_gpu_mig_strategy.assert_called_once_with(agentpool)
decorator.update_crg.assert_called_once_with(agentpool)

def test_update_agentpool_profile_preview_execution_order(self):
"""Test that update methods are called in the correct order."""
Expand Down Expand Up @@ -442,6 +451,7 @@ def mock_method(pool):
decorator.update_blue_green_upgrade_settings = create_mock_update_method("update_blue_green_upgrade_settings")
decorator.update_gpu_profile = create_mock_update_method("update_gpu_profile")
decorator.update_gpu_mig_strategy = create_mock_update_method("update_gpu_mig_strategy")
decorator.update_crg = create_mock_update_method("update_crg")

# Act
decorator.update_agentpool_profile_preview()
Expand All @@ -463,6 +473,7 @@ def mock_method(pool):
"update_blue_green_upgrade_settings",
"update_gpu_profile",
"update_gpu_mig_strategy",
"update_crg",
]
self.assertEqual(call_order, expected_order)

Expand Down Expand Up @@ -514,6 +525,7 @@ def track_and_return(pool):
decorator.update_blue_green_upgrade_settings = create_tracking_mock("update_blue_green_upgrade_settings")
decorator.update_gpu_profile = create_tracking_mock("update_gpu_profile")
decorator.update_gpu_mig_strategy = create_tracking_mock("update_gpu_mig_strategy")
decorator.update_crg = create_tracking_mock("update_crg")

# Act
result = decorator.update_agentpool_profile_preview()
Expand Down Expand Up @@ -577,7 +589,7 @@ def test_update_agentpool_profile_preview_mixed_modes_scenario(self):
'update_secure_boot', 'update_vtpm', 'update_os_sku', 'update_fips_image',
'update_ssh_access', 'update_vm_size', 'update_localdns_profile', 'update_auto_scaler_properties_vms',
'update_upgrade_strategy', 'update_blue_green_upgrade_settings', 'update_gpu_profile',
'update_gpu_mig_strategy'
'update_gpu_mig_strategy', 'update_crg'
]

for method_name in update_methods:
Expand Down Expand Up @@ -653,6 +665,7 @@ def test_update_agentpool_profile_preview_managed_cluster_mode(self):
decorator.update_blue_green_upgrade_settings = Mock(return_value=agentpool)
decorator.update_gpu_profile = Mock(return_value=agentpool)
decorator.update_gpu_mig_strategy = Mock(return_value=agentpool)
decorator.update_crg = Mock(return_value=agentpool)

# Act
result = decorator.update_agentpool_profile_preview(agentpools)
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 = "20.0.0b6"
VERSION = "20.0.0b7"

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