Skip to content

Commit c09ce13

Browse files
authored
[AKS] az aks nodepool add/update: Add --enable-managed-dranet (#10266)
1 parent 47971a1 commit c09ce13

7 files changed

Lines changed: 130 additions & 3 deletions

File tree

‎src/aks-preview/HISTORY.rst‎

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

1212
Pending
1313
+++++++
14+
15+
22.0.0b6
16+
+++++++++
17+
* `az aks nodepool add/update`: Add preview `--enable-managed-dranet` to enable Managed DRANET on a node pool.
1418
* `az aks nodepool add` and `az aks nodepool update`: Add `--managed-gpu-driver-mode` to select `DRA` or `DevicePlugin` when managed GPU is enabled.
1519
* Add options `Windows2022` and `Windows2025` to `--os-sku` for `az aks nodepool update`, allowing in-place OS SKU upgrades between these Windows Server versions.
1620
* `az aks create` and `az aks nodepool add`: `--enable-fips-image` is now required and always enabled when `--os-sku` is `Windows2025`; `--disable-fips-image` cannot be used with `Windows2025`.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,6 +2664,9 @@
26642664
Specify secondary NICs to attach to each node. Accepts inline JSON or `@filename`.
26652665
Example: '[{"type":"Standard","vnetSubnetId":"/subscriptions/.../subnets/mysubnet","enableAcceleratedNetworking":true}]'
26662666
Supported NIC types are "Standard" (requires vnetSubnetId) and "Dynamic".
2667+
- name: --enable-managed-dranet
2668+
type: bool
2669+
short-summary: Enable Managed DRANET on the node pool.
26672670
- name: --upgrade-strategy
26682671
type: string
26692672
short-summary: Upgrade strategy for the node pool. Allowed values are "Rolling" or "BlueGreen". Default is "Rolling".
@@ -2837,6 +2840,9 @@
28372840
- name: --asg-ids
28382841
type: string
28392842
short-summary: The IDs of the application security groups to which the node pool's network interface should belong. When specified, format should be a comma-separated list of IDs. Must use VMSS agent pool type.
2843+
- name: --enable-managed-dranet
2844+
type: bool
2845+
short-summary: Enable Managed DRANET on the node pool.
28402846
- name: --enable-artifact-streaming
28412847
type: bool
28422848
short-summary: Enable artifact streaming for VirtualMachineScaleSets managed by a node pool, to speed up the cold-start of containers on a node through on-demand image loading. To use this feature, container images must also enable artifact streaming on ACR. If not specified, the default is false.

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,6 +2525,11 @@ def load_arguments(self, _):
25252525
'Example: \'[{"type":"Standard","vnetSubnetId":"/subscriptions/.../subnets/mysubnet"}]\'',
25262526
is_preview=True,
25272527
)
2528+
c.argument(
2529+
"enable_managed_dranet",
2530+
action="store_true",
2531+
is_preview=True,
2532+
)
25282533
# prepared image specification
25292534
c.argument(
25302535
'prepared_image_specification_id',
@@ -2579,6 +2584,11 @@ def load_arguments(self, _):
25792584
c.argument(
25802585
"asg_ids", validator=validate_application_security_groups, is_preview=True
25812586
)
2587+
c.argument(
2588+
"enable_managed_dranet",
2589+
action="store_true",
2590+
is_preview=True,
2591+
)
25822592
c.argument(
25832593
"enable_artifact_streaming",
25842594
action="store_true",

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ def get_allowed_host_ports(self) -> Union[List[PortRange], None]:
336336
))
337337
return port_ranges
338338

339+
def get_enable_managed_dranet(self) -> bool:
340+
"""Obtain the value of enable_managed_dranet."""
341+
return self.raw_param.get("enable_managed_dranet")
342+
339343
def get_ip_tags(self) -> Union[List[IPTag], None]:
340344
ip_tags = self.raw_param.get("node_public_ip_tags")
341345
res = []
@@ -1454,6 +1458,11 @@ def set_up_agentpool_network_profile(self, agentpool: AgentPool) -> AgentPool:
14541458
if secondary_nics is not None:
14551459
agentpool.network_profile.secondary_network_interfaces = secondary_nics
14561460

1461+
if self.context.get_enable_managed_dranet():
1462+
agentpool.network_profile.dranet = self.models.DRANETProfile(
1463+
mode="Managed"
1464+
)
1465+
14571466
return agentpool
14581467

14591468
def set_up_taints(self, agentpool: AgentPool) -> AgentPool:
@@ -1959,12 +1968,17 @@ def update_network_profile(self, agentpool: AgentPool) -> AgentPool:
19591968

19601969
asg_ids = self.context.get_asg_ids()
19611970
allowed_host_ports = self.context.get_allowed_host_ports()
1962-
if not agentpool.network_profile and (asg_ids or allowed_host_ports):
1971+
enable_managed_dranet = self.context.get_enable_managed_dranet()
1972+
if not agentpool.network_profile and (asg_ids is not None or allowed_host_ports is not None or enable_managed_dranet):
19631973
agentpool.network_profile = self.models.AgentPoolNetworkProfile() # pylint: disable=no-member
19641974
if asg_ids is not None:
19651975
agentpool.network_profile.application_security_groups = asg_ids
19661976
if allowed_host_ports is not None:
19671977
agentpool.network_profile.allowed_host_ports = allowed_host_ports
1978+
if enable_managed_dranet:
1979+
agentpool.network_profile.dranet = self.models.DRANETProfile(
1980+
mode="Managed"
1981+
)
19681982
return agentpool
19691983

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,6 +2289,7 @@ def aks_agentpool_add(
22892289
disable_windows_outbound_nat=False,
22902290
allowed_host_ports=None,
22912291
asg_ids=None,
2292+
enable_managed_dranet=False,
22922293
node_public_ip_tags=None,
22932294
enable_artifact_streaming=False,
22942295
enable_managed_gpu=False,
@@ -2374,6 +2375,7 @@ def aks_agentpool_update(
23742375
# extensions
23752376
allowed_host_ports=None,
23762377
asg_ids=None,
2378+
enable_managed_dranet=False,
23772379
enable_artifact_streaming=False,
23782380
disable_artifact_streaming=False,
23792381
enable_managed_gpu=False,

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

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,25 @@ def common_get_enable_artifact_streaming(self):
254254
self.agentpool_decorator_mode,
255255
)
256256
self.assertEqual(ctx_2.get_enable_artifact_streaming(), None)
257+
258+
def common_get_enable_managed_dranet(self):
259+
ctx_1 = AKSPreviewAgentPoolContext(
260+
self.cmd,
261+
AKSAgentPoolParamDict({"enable_managed_dranet": False}),
262+
self.models,
263+
DecoratorMode.CREATE,
264+
self.agentpool_decorator_mode,
265+
)
266+
self.assertEqual(ctx_1.get_enable_managed_dranet(), False)
267+
268+
ctx_2 = AKSPreviewAgentPoolContext(
269+
self.cmd,
270+
AKSAgentPoolParamDict({"enable_managed_dranet": True}),
271+
self.models,
272+
DecoratorMode.UPDATE,
273+
self.agentpool_decorator_mode,
274+
)
275+
self.assertEqual(ctx_2.get_enable_managed_dranet(), True)
257276
agentpool_2 = self.create_initialized_agentpool_instance(
258277
artifact_streaming_profile=self.models.AgentPoolArtifactStreamingProfile(
259278
enabled=True
@@ -1416,6 +1435,9 @@ def test_get_workload_runtime(self):
14161435
def test_get_enable_artifact_streaming(self):
14171436
self.common_get_enable_artifact_streaming()
14181437

1438+
def test_get_enable_managed_dranet(self):
1439+
self.common_get_enable_managed_dranet()
1440+
14191441
def test_get_enable_os_disk_full_caching(self):
14201442
self.common_get_enable_os_disk_full_caching()
14211443

@@ -1534,6 +1556,9 @@ def test_get_workload_runtime(self):
15341556
def test_get_enable_artifact_streaming(self):
15351557
self.common_get_enable_artifact_streaming()
15361558

1559+
def test_get_enable_managed_dranet(self):
1560+
self.common_get_enable_managed_dranet()
1561+
15371562
def test_get_enable_os_disk_full_caching(self):
15381563
self.common_get_enable_os_disk_full_caching()
15391564

@@ -2099,6 +2124,31 @@ def common_set_up_agentpool_gateway_profile(self):
20992124
)
21002125
self.assertEqual(dec_agentpool_1, ground_truth_agentpool_1)
21012126

2127+
def common_set_up_managed_dranet(self):
2128+
dec_1 = AKSPreviewAgentPoolAddDecorator(
2129+
self.cmd,
2130+
self.client,
2131+
{"enable_managed_dranet": False},
2132+
self.resource_type,
2133+
self.agentpool_decorator_mode,
2134+
)
2135+
agentpool_1 = self.create_initialized_agentpool_instance(restore_defaults=False)
2136+
dec_1.context.attach_agentpool(agentpool_1)
2137+
dec_agentpool_1 = dec_1.set_up_agentpool_network_profile(agentpool_1)
2138+
self.assertIsNone(dec_agentpool_1.network_profile.dranet)
2139+
2140+
dec_2 = AKSPreviewAgentPoolAddDecorator(
2141+
self.cmd,
2142+
self.client,
2143+
{"enable_managed_dranet": True},
2144+
self.resource_type,
2145+
self.agentpool_decorator_mode,
2146+
)
2147+
agentpool_2 = self.create_initialized_agentpool_instance(restore_defaults=False)
2148+
dec_2.context.attach_agentpool(agentpool_2)
2149+
dec_agentpool_2 = dec_2.set_up_agentpool_network_profile(agentpool_2)
2150+
self.assertEqual(dec_agentpool_2.network_profile.dranet.mode, "Managed")
2151+
21022152
def common_set_up_virtual_machines_profile(self):
21032153
dec_1 = AKSPreviewAgentPoolAddDecorator(
21042154
self.cmd,
@@ -2540,6 +2590,9 @@ def test_set_up_agentpool_windows_profile(self):
25402590
def test_set_up_agentpool_gateway_profile(self):
25412591
self.common_set_up_agentpool_gateway_profile()
25422592

2593+
def test_set_up_managed_dranet(self):
2594+
self.common_set_up_managed_dranet()
2595+
25432596
def test_set_up_virtual_machines_profile(self):
25442597
self.common_set_up_virtual_machines_profile()
25452598

@@ -2770,6 +2823,9 @@ def test_set_up_agentpool_windows_profile(self):
27702823
def test_set_up_agentpool_gateway_profile(self):
27712824
self.common_set_up_agentpool_gateway_profile()
27722825

2826+
def test_set_up_managed_dranet(self):
2827+
self.common_set_up_managed_dranet()
2828+
27732829
def test_set_up_virtual_machines_profile(self):
27742830
self.common_set_up_virtual_machines_profile()
27752831

@@ -2995,6 +3051,35 @@ def common_update_artifact_streaming(self):
29953051
with self.assertRaises(MutuallyExclusiveArgumentError):
29963052
dec_4.update_artifact_streaming(agentpool_3)
29973053

3054+
def common_update_managed_dranet(self):
3055+
dec_1 = AKSPreviewAgentPoolUpdateDecorator(
3056+
self.cmd,
3057+
self.client,
3058+
{"enable_managed_dranet": False},
3059+
self.resource_type,
3060+
self.agentpool_decorator_mode,
3061+
)
3062+
agentpool_1 = self.create_initialized_agentpool_instance(
3063+
network_profile=self.models.AgentPoolNetworkProfile(
3064+
dranet=self.models.DRANETProfile(mode="Managed")
3065+
)
3066+
)
3067+
dec_1.context.attach_agentpool(agentpool_1)
3068+
dec_agentpool_1 = dec_1.update_network_profile(agentpool_1)
3069+
self.assertEqual(dec_agentpool_1.network_profile.dranet.mode, "Managed")
3070+
3071+
dec_2 = AKSPreviewAgentPoolUpdateDecorator(
3072+
self.cmd,
3073+
self.client,
3074+
{"enable_managed_dranet": True},
3075+
self.resource_type,
3076+
self.agentpool_decorator_mode,
3077+
)
3078+
agentpool_2 = self.create_initialized_agentpool_instance()
3079+
dec_2.context.attach_agentpool(agentpool_2)
3080+
dec_agentpool_2 = dec_2.update_network_profile(agentpool_2)
3081+
self.assertEqual(dec_agentpool_2.network_profile.dranet.mode, "Managed")
3082+
29983083
def common_update_managed_gpu(self):
29993084
dec_1 = AKSPreviewAgentPoolUpdateDecorator(
30003085
self.cmd,
@@ -3679,6 +3764,9 @@ def setUp(self):
36793764
def test_update_artifact_streaming(self):
36803765
self.common_update_artifact_streaming()
36813766

3767+
def test_update_managed_dranet(self):
3768+
self.common_update_managed_dranet()
3769+
36823770
def test_update_managed_gpu(self):
36833771
self.common_update_managed_gpu()
36843772

@@ -3782,7 +3870,10 @@ def setUp(self):
37823870

37833871
def test_update_artifact_streaming(self):
37843872
self.common_update_artifact_streaming()
3785-
3873+
3874+
def test_update_managed_dranet(self):
3875+
self.common_update_managed_dranet()
3876+
37863877
def test_update_managed_gpu(self):
37873878
self.common_update_managed_gpu()
37883879

‎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.0b5"
12+
VERSION = "22.0.0b6"
1313

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

0 commit comments

Comments
 (0)