Skip to content

Commit 246bd0c

Browse files
authored
[AKS] az aks nodepool update: Add GPU driver install options install and none for --gpu-driver parameter (#9472)
1 parent 5c3a479 commit 246bd0c

File tree

8 files changed

+68
-3
lines changed

8 files changed

+68
-3
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Pending
1515
19.0.0b18
1616
+++++++
1717
* Vendor new SDK and bump API version to 2025-10-02-preview.
18+
* Add option `--gpu-driver` to `az aks nodepool update` to select skipping GPU driver installation.
1819

1920
19.0.0b17
2021
+++++++

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,6 +2427,9 @@
24272427
- name: --final-soak-duration
24282428
type: int
24292429
short-summary: Wait time (in minutes) after all old nodes are drained before removing them. Default is 60 minutes. Only for blue-green upgrades.
2430+
- name: --gpu-driver
2431+
type: string
2432+
short-summary: Whether to install driver for GPU node pool. Possible values are "Install" or "None".
24302433
examples:
24312434
- name: Reconcile the nodepool back to its current state.
24322435
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,10 @@ def load_arguments(self, _):
21292129
options_list=["--node-vm-size", "-s"],
21302130
completer=get_vm_size_completion_list,
21312131
)
2132+
c.argument(
2133+
"gpu_driver",
2134+
arg_type=get_enum_type(gpu_driver_install_modes)
2135+
)
21322136

21332137
with self.argument_context("aks nodepool upgrade") as c:
21342138
# upgrade strategy

src/aks-preview/azext_aks_preview/agentpool_decorator.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,17 @@ def update_network_profile(self, agentpool: AgentPool) -> AgentPool:
16441644
agentpool.network_profile.allowed_host_ports = allowed_host_ports
16451645
return agentpool
16461646

1647+
def update_gpu_profile(self, agentpool: AgentPool) -> AgentPool:
1648+
self._ensure_agentpool(agentpool)
1649+
1650+
gpu_driver = self.context.get_gpu_driver()
1651+
driver_type = self.context.get_driver_type()
1652+
if not agentpool.gpu_profile and (gpu_driver or driver_type):
1653+
agentpool.gpu_profile = self.models.GPUProfile()
1654+
if gpu_driver is not None:
1655+
agentpool.gpu_profile.driver = gpu_driver
1656+
return agentpool
1657+
16471658
def update_artifact_streaming(self, agentpool: AgentPool) -> AgentPool:
16481659
"""Update artifact streaming property for the AgentPool object.
16491660
:return: the AgentPool object
@@ -1807,6 +1818,9 @@ def update_agentpool_profile_preview(self, agentpools: List[AgentPool] = None) -
18071818
# update blue-green upgrade settings
18081819
agentpool = self.update_blue_green_upgrade_settings(agentpool)
18091820

1821+
# update gpu profile
1822+
agentpool = self.update_gpu_profile(agentpool)
1823+
18101824
return agentpool
18111825

18121826
def update_auto_scaler_properties(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
@@ -1977,6 +1977,7 @@ def aks_agentpool_update(
19771977
# local DNS
19781978
localdns_config=None,
19791979
node_vm_size=None,
1980+
gpu_driver=None,
19801981
):
19811982
# DO NOT MOVE: get all the original parameters and save them as a dictionary
19821983
raw_parameters = locals()

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,6 +2660,31 @@ def common_update_localdns_profile(self):
26602660
finally:
26612661
os.unlink(config_file_path)
26622662

2663+
def common_update_gpu_profile(self):
2664+
dec_1 = AKSPreviewAgentPoolUpdateDecorator(
2665+
self.cmd,
2666+
self.client,
2667+
{"gpu_driver": "None"},
2668+
self.resource_type,
2669+
self.agentpool_decorator_mode,
2670+
)
2671+
# fail on passing the wrong agentpool object
2672+
with self.assertRaises(CLIInternalError):
2673+
dec_1.update_gpu_profile(None)
2674+
agentpool_1 = self.create_initialized_agentpool_instance(
2675+
gpu_profile=self.models.GPUProfile(
2676+
driver="Install",
2677+
)
2678+
)
2679+
dec_1.context.attach_agentpool(agentpool_1)
2680+
dec_agentpool_1 = dec_1.update_gpu_profile(agentpool_1)
2681+
ground_truth_agentpool_1 = self.create_initialized_agentpool_instance(
2682+
gpu_profile=self.models.GPUProfile(
2683+
driver="None",
2684+
)
2685+
)
2686+
self.assertEqual(dec_agentpool_1, ground_truth_agentpool_1)
2687+
26632688
def common_test_process_dns_overrides_helper(self):
26642689
from azext_aks_preview._helpers import process_dns_overrides
26652690

@@ -2744,6 +2769,9 @@ def test_update_blue_green_upgrade_settings(self):
27442769
def test_update_localdns_profile(self):
27452770
self.common_update_localdns_profile()
27462771

2772+
def test_update_gpu_profile(self):
2773+
self.common_update_gpu_profile()
2774+
27472775
def test_process_dns_overrides_helper(self):
27482776
self.common_test_process_dns_overrides_helper()
27492777

@@ -2837,6 +2865,9 @@ def test_update_localdns_profile(self):
28372865
def test_process_dns_overrides_helper(self):
28382866
self.common_test_process_dns_overrides_helper()
28392867

2868+
def test_update_gpu_profile(self):
2869+
self.common_update_gpu_profile()
2870+
28402871
def test_update_agentpool_profile_preview(self):
28412872
import inspect
28422873

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def test_update_agentpool_profile_preview_default_behavior(self):
132132
decorator.update_auto_scaler_properties_vms = Mock(return_value=agentpool)
133133
decorator.update_upgrade_strategy = Mock(return_value=agentpool)
134134
decorator.update_blue_green_upgrade_settings = Mock(return_value=agentpool)
135+
decorator.update_gpu_profile = Mock(return_value=agentpool)
135136

136137
# Act
137138
result = decorator.update_agentpool_profile_preview()
@@ -154,6 +155,7 @@ def test_update_agentpool_profile_preview_default_behavior(self):
154155
decorator.update_auto_scaler_properties_vms.assert_called_once_with(agentpool)
155156
decorator.update_upgrade_strategy.assert_called_once_with(agentpool)
156157
decorator.update_blue_green_upgrade_settings.assert_called_once_with(agentpool)
158+
decorator.update_gpu_profile.assert_called_once_with(agentpool)
157159

158160
def test_update_agentpool_profile_preview_with_agentpools_parameter(self):
159161
"""Test update_agentpool_profile_preview with agentpools parameter."""
@@ -194,6 +196,7 @@ def test_update_agentpool_profile_preview_with_agentpools_parameter(self):
194196
decorator.update_auto_scaler_properties_vms = Mock(return_value=agentpool)
195197
decorator.update_upgrade_strategy = Mock(return_value=agentpool)
196198
decorator.update_blue_green_upgrade_settings = Mock(return_value=agentpool)
199+
decorator.update_gpu_profile = Mock(return_value=agentpool)
197200

198201
# Act
199202
result = decorator.update_agentpool_profile_preview(agentpools)
@@ -244,6 +247,7 @@ def test_update_agentpool_profile_preview_managed_system_mode(self):
244247
decorator.update_auto_scaler_properties_vms = Mock()
245248
decorator.update_upgrade_strategy = Mock()
246249
decorator.update_blue_green_upgrade_settings = Mock()
250+
decorator.update_gpu_profile = Mock()
247251

248252
# Act
249253
result = decorator.update_agentpool_profile_preview()
@@ -272,6 +276,7 @@ def test_update_agentpool_profile_preview_managed_system_mode(self):
272276
decorator.update_auto_scaler_properties_vms.assert_not_called()
273277
decorator.update_upgrade_strategy.assert_not_called()
274278
decorator.update_blue_green_upgrade_settings.assert_not_called()
279+
decorator.update_gpu_profile.assert_not_called()
275280

276281
def test_update_agentpool_profile_preview_managed_system_mode_with_agentpools(self):
277282
"""Test update_agentpool_profile_preview with ManagedSystem mode and agentpools parameter."""
@@ -349,6 +354,7 @@ def test_update_agentpool_profile_preview_system_mode_regular_flow(self):
349354
decorator.update_auto_scaler_properties_vms = Mock(return_value=agentpool)
350355
decorator.update_upgrade_strategy = Mock(return_value=agentpool)
351356
decorator.update_blue_green_upgrade_settings = Mock(return_value=agentpool)
357+
decorator.update_gpu_profile = Mock(return_value=agentpool)
352358

353359
# Act
354360
result = decorator.update_agentpool_profile_preview()
@@ -369,6 +375,7 @@ def test_update_agentpool_profile_preview_system_mode_regular_flow(self):
369375
decorator.update_auto_scaler_properties_vms.assert_called_once_with(agentpool)
370376
decorator.update_upgrade_strategy.assert_called_once_with(agentpool)
371377
decorator.update_blue_green_upgrade_settings.assert_called_once_with(agentpool)
378+
decorator.update_gpu_profile.assert_called_once_with(agentpool)
372379

373380
def test_update_agentpool_profile_preview_execution_order(self):
374381
"""Test that update methods are called in the correct order."""
@@ -414,6 +421,7 @@ def mock_method(pool):
414421
decorator.update_auto_scaler_properties_vms = create_mock_update_method("update_auto_scaler_properties_vms")
415422
decorator.update_upgrade_strategy = create_mock_update_method("update_upgrade_strategy")
416423
decorator.update_blue_green_upgrade_settings = create_mock_update_method("update_blue_green_upgrade_settings")
424+
decorator.update_gpu_profile = create_mock_update_method("update_gpu_profile")
417425

418426
# Act
419427
decorator.update_agentpool_profile_preview()
@@ -430,7 +438,8 @@ def mock_method(pool):
430438
"update_localdns_profile",
431439
"update_auto_scaler_properties_vms",
432440
"update_upgrade_strategy",
433-
"update_blue_green_upgrade_settings"
441+
"update_blue_green_upgrade_settings",
442+
"update_gpu_profile",
434443
]
435444
self.assertEqual(call_order, expected_order)
436445

@@ -478,6 +487,7 @@ def track_and_return(pool):
478487
decorator.update_auto_scaler_properties_vms = create_tracking_mock("update_auto_scaler_properties_vms")
479488
decorator.update_upgrade_strategy = create_tracking_mock("update_upgrade_strategy")
480489
decorator.update_blue_green_upgrade_settings = create_tracking_mock("update_blue_green_upgrade_settings")
490+
decorator.update_gpu_profile = create_tracking_mock("update_gpu_profile")
481491

482492
# Act
483493
result = decorator.update_agentpool_profile_preview()
@@ -540,7 +550,7 @@ def test_update_agentpool_profile_preview_mixed_modes_scenario(self):
540550
'update_network_profile', 'update_artifact_streaming',
541551
'update_secure_boot', 'update_vtpm', 'update_os_sku', 'update_fips_image',
542552
'update_ssh_access', 'update_localdns_profile', 'update_auto_scaler_properties_vms',
543-
'update_upgrade_strategy', 'update_blue_green_upgrade_settings'
553+
'update_upgrade_strategy', 'update_blue_green_upgrade_settings', 'update_gpu_profile'
544554
]
545555

546556
for method_name in update_methods:
@@ -612,6 +622,7 @@ def test_update_agentpool_profile_preview_managed_cluster_mode(self):
612622
decorator.update_auto_scaler_properties_vms = Mock(return_value=agentpool)
613623
decorator.update_upgrade_strategy = Mock(return_value=agentpool)
614624
decorator.update_blue_green_upgrade_settings = Mock(return_value=agentpool)
625+
decorator.update_gpu_profile = Mock(return_value=agentpool)
615626

616627
# Act
617628
result = decorator.update_agentpool_profile_preview(agentpools)

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 = "19.0.0b17"
12+
VERSION = "19.0.0b18"
1313

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

0 commit comments

Comments
 (0)