Skip to content

Commit a6de7cc

Browse files
authored
Add new --node-provisioning-default-pools parameter (Azure#8857)
1 parent b8c3eca commit a6de7cc

13 files changed

+2928
-7080
lines changed

src/aks-preview/HISTORY.rst

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

1212
Pending
1313
+++++++
14+
* Add `--node-provisioning-default-pools` to the `az aks update` command.
15+
* Add `--node-provisioning-default-pools` to the `az aks create` command.
1416

1517
18.0.0b13
1618
+++++++

src/aks-preview/azext_aks_preview/_consts.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@
319319
CONST_NODE_PROVISIONING_MODE_MANUAL = "Manual"
320320
CONST_NODE_PROVISIONING_MODE_AUTO = "Auto"
321321

322+
# Node Provisioning Default Pools Consts
323+
CONST_NODE_PROVISIONING_DEFAULT_POOLS_AUTO = "Auto"
324+
CONST_NODE_PROVISIONING_DEFAULT_POOLS_NONE = "None"
325+
322326
# Node Provisioning State Consts
323327
CONST_NODE_PROVISIONING_STATE_SUCCEEDED = "Succeeded"
324328

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,14 @@
596596
- name: --node-provisioning-mode
597597
type: string
598598
short-summary: Set the node provisioning mode of the cluster. Valid values are "Auto" and "Manual". For more information on "Auto" mode see aka.ms/aks/nap.
599+
- name: --node-provisioning-default-pools
600+
type: string
601+
short-summary: The set of default Karpenter NodePools configured for node provisioning. Valid values are "Auto" and "None".
602+
long-summary: |-
603+
The set of default Karpenter NodePools configured for node provisioning. Valid values are "Auto" and "None".
604+
Auto: A standard set of Karpenter NodePools are provisioned.
605+
None: No Karpenter NodePools are provisioned.
606+
WARNING: Changing this from Auto to None on an existing cluster will cause the default Karpenter NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted by that action.
599607
- name: --enable-app-routing
600608
type: bool
601609
short-summary: Enable Application Routing addon.
@@ -1230,6 +1238,14 @@
12301238
- name: --node-provisioning-mode
12311239
type: string
12321240
short-summary: Set the node provisioning mode of the cluster. Valid values are "Auto" and "Manual". For more information on "Auto" mode see aka.ms/aks/nap.
1241+
- name: --node-provisioning-default-pools
1242+
type: string
1243+
short-summary: The set of default Karpenter NodePools configured for node provisioning. Valid values are "Auto" and "None".
1244+
long-summary: |-
1245+
The set of default Karpenter NodePools configured for node provisioning. Valid values are "Auto" and "None".
1246+
Auto: A standard set of Karpenter NodePools are provisioned.
1247+
None: No Karpenter NodePools are provisioned.
1248+
WARNING: Changing this from Auto to None on an existing cluster will cause the default Karpenter NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted by that action.
12331249
- name: --enable-ai-toolchain-operator
12341250
type: bool
12351251
short-summary: Enable AI toolchain operator to the cluster

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@
126126
CONST_WORKLOAD_RUNTIME_WASM_WASI,
127127
CONST_NODE_PROVISIONING_MODE_MANUAL,
128128
CONST_NODE_PROVISIONING_MODE_AUTO,
129+
CONST_NODE_PROVISIONING_DEFAULT_POOLS_AUTO,
130+
CONST_NODE_PROVISIONING_DEFAULT_POOLS_NONE,
129131
CONST_MANAGED_CLUSTER_SKU_NAME_BASE,
130132
CONST_MANAGED_CLUSTER_SKU_NAME_AUTOMATIC,
131133
CONST_SSH_ACCESS_LOCALUSER,
@@ -456,12 +458,16 @@
456458
CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD,
457459
]
458460

459-
# consts for guardrails level
460461
node_provisioning_modes = [
461462
CONST_NODE_PROVISIONING_MODE_MANUAL,
462463
CONST_NODE_PROVISIONING_MODE_AUTO,
463464
]
464465

466+
node_provisioning_default_pools = [
467+
CONST_NODE_PROVISIONING_DEFAULT_POOLS_AUTO,
468+
CONST_NODE_PROVISIONING_DEFAULT_POOLS_NONE,
469+
]
470+
465471
ssh_accesses = [
466472
CONST_SSH_ACCESS_LOCALUSER,
467473
CONST_SSH_ACCESS_DISABLED,
@@ -1016,6 +1022,20 @@ def load_arguments(self, _):
10161022
'For more information on "Auto" mode see aka.ms/aks/nap.'
10171023
)
10181024
)
1025+
c.argument(
1026+
"node_provisioning_default_pools",
1027+
is_preview=True,
1028+
arg_type=get_enum_type(node_provisioning_default_pools),
1029+
help=(
1030+
'The set of default Karpenter NodePools configured for node provisioning. '
1031+
'Valid values are "Auto" and "None". Auto: A standard set of Karpenter NodePools are provisioned. '
1032+
'None: No Karpenter NodePools are provisioned. '
1033+
'WARNING: Changing this from Auto to None on an existing cluster will cause the default Karpenter '
1034+
'NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. '
1035+
'It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted '
1036+
'by that action.'
1037+
)
1038+
)
10191039
# in creation scenario, use "localuser" as default
10201040
c.argument(
10211041
'ssh_access',
@@ -1461,6 +1481,20 @@ def load_arguments(self, _):
14611481
'For more information on "Auto" mode see aka.ms/aks/nap.'
14621482
)
14631483
)
1484+
c.argument(
1485+
"node_provisioning_default_pools",
1486+
is_preview=True,
1487+
arg_type=get_enum_type(node_provisioning_default_pools),
1488+
help=(
1489+
'The set of default Karpenter NodePools configured for node provisioning. '
1490+
'Valid values are "Auto" and "None". Auto: A standard set of Karpenter NodePools are provisioned. '
1491+
'None: No Karpenter NodePools are provisioned. '
1492+
'WARNING: Changing this from Auto to None on an existing cluster will cause the default Karpenter '
1493+
'NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. '
1494+
'It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted '
1495+
'by that action.'
1496+
)
1497+
)
14641498
c.argument('enable_static_egress_gateway', is_preview=True, action='store_true')
14651499
c.argument('disable_static_egress_gateway', is_preview=True, action='store_true')
14661500
c.argument("enable_imds_restriction", action="store_true", is_preview=True)

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ def aks_create(
718718
ephemeral_disk_volume_type=None,
719719
ephemeral_disk_nvme_perf_tier=None,
720720
node_provisioning_mode=None,
721+
node_provisioning_default_pools=None,
721722
ssh_access=CONST_SSH_ACCESS_LOCALUSER,
722723
# trusted launch
723724
enable_secure_boot=False,
@@ -933,6 +934,7 @@ def aks_update(
933934
ephemeral_disk_volume_type=None,
934935
ephemeral_disk_nvme_perf_tier=None,
935936
node_provisioning_mode=None,
937+
node_provisioning_default_pools=None,
936938
cluster_service_load_balancer_health_probe_mode=None,
937939
if_match=None,
938940
if_none_match=None,

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,6 +2749,11 @@ def get_node_provisioning_mode(self) -> Union[str, None]:
27492749
"""
27502750
return self.raw_param.get("node_provisioning_mode")
27512751

2752+
def get_node_provisioning_default_pools(self) -> Union[str, None]:
2753+
"""Obtain the value of node_provisioning_default_pools.
2754+
"""
2755+
return self.raw_param.get("node_provisioning_default_pools")
2756+
27522757
def get_ai_toolchain_operator(self, enable_validation: bool = False) -> bool:
27532758
"""Internal function to obtain the value of enable_ai_toolchain_operator.
27542759
@@ -3542,10 +3547,26 @@ def set_up_node_provisioning_mode(self, mc: ManagedCluster) -> ManagedCluster:
35423547

35433548
return mc
35443549

3550+
def set_up_node_provisioning_default_pools(self, mc: ManagedCluster) -> ManagedCluster:
3551+
self._ensure_mc(mc)
3552+
3553+
default_pools = self.context.get_node_provisioning_default_pools()
3554+
if default_pools is not None:
3555+
if mc.node_provisioning_profile is None:
3556+
mc.node_provisioning_profile = (
3557+
self.models.ManagedClusterNodeProvisioningProfile() # pylint: disable=no-member
3558+
)
3559+
3560+
# set default_node_pools
3561+
mc.node_provisioning_profile.default_node_pools = default_pools
3562+
3563+
return mc
3564+
35453565
def set_up_node_provisioning_profile(self, mc: ManagedCluster) -> ManagedCluster:
35463566
self._ensure_mc(mc)
35473567

35483568
mc = self.set_up_node_provisioning_mode(mc)
3569+
mc = self.set_up_node_provisioning_default_pools(mc)
35493570

35503571
return mc
35513572

@@ -5060,6 +5081,21 @@ def update_node_provisioning_mode(self, mc: ManagedCluster) -> ManagedCluster:
50605081

50615082
return mc
50625083

5084+
def update_node_provisioning_default_pools(self, mc: ManagedCluster) -> ManagedCluster:
5085+
self._ensure_mc(mc)
5086+
5087+
default_pools = self.context.get_node_provisioning_default_pools()
5088+
if default_pools is not None:
5089+
if mc.node_provisioning_profile is None:
5090+
mc.node_provisioning_profile = (
5091+
self.models.ManagedClusterNodeProvisioningProfile() # pylint: disable=no-member
5092+
)
5093+
5094+
# set default_node_pools
5095+
mc.node_provisioning_profile.default_node_pools = default_pools
5096+
5097+
return mc
5098+
50635099
# pylint: disable=too-many-branches
50645100
def update_app_routing_profile(self, mc: ManagedCluster) -> ManagedCluster:
50655101
"""Update app routing profile for the ManagedCluster object.
@@ -5222,6 +5258,7 @@ def update_node_provisioning_profile(self, mc: ManagedCluster) -> ManagedCluster
52225258
self._ensure_mc(mc)
52235259

52245260
mc = self.update_node_provisioning_mode(mc)
5261+
mc = self.update_node_provisioning_default_pools(mc)
52255262

52265263
return mc
52275264

0 commit comments

Comments
 (0)