Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ To release a new version, please select a new version number (usually plus 1 to

Pending
+++++++
* Add `--node-provisioning-default-pools` to the `az aks update` command.
* Add `--node-provisioning-default-pools` to the `az aks create` command.

18.0.0b13
+++++++
Expand Down
4 changes: 4 additions & 0 deletions src/aks-preview/azext_aks_preview/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@
CONST_NODE_PROVISIONING_MODE_MANUAL = "Manual"
CONST_NODE_PROVISIONING_MODE_AUTO = "Auto"

# Node Provisioning Default Pools Consts
CONST_NODE_PROVISIONING_DEFAULT_POOLS_AUTO = "Auto"
CONST_NODE_PROVISIONING_DEFAULT_POOLS_NONE = "None"

# Node Provisioning State Consts
CONST_NODE_PROVISIONING_STATE_SUCCEEDED = "Succeeded"

Expand Down
16 changes: 16 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,14 @@
- name: --node-provisioning-mode
type: string
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.
- name: --node-provisioning-default-pools
type: string
short-summary: The set of default Karpenter NodePools configured for node provisioning. Valid values are "Auto" and "None".
long-summary: |-
The set of default Karpenter NodePools configured for node provisioning. Valid values are "Auto" and "None".
Auto: A standard set of Karpenter NodePools are provisioned.
None: No Karpenter NodePools are provisioned.
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.
- name: --enable-app-routing
type: bool
short-summary: Enable Application Routing addon.
Expand Down Expand Up @@ -1230,6 +1238,14 @@
- name: --node-provisioning-mode
type: string
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.
- name: --node-provisioning-default-pools
type: string
short-summary: The set of default Karpenter NodePools configured for node provisioning. Valid values are "Auto" and "None".
long-summary: |-
The set of default Karpenter NodePools configured for node provisioning. Valid values are "Auto" and "None".
Auto: A standard set of Karpenter NodePools are provisioned.
None: No Karpenter NodePools are provisioned.
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.
- name: --enable-ai-toolchain-operator
type: bool
short-summary: Enable AI toolchain operator to the cluster
Expand Down
36 changes: 35 additions & 1 deletion src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
CONST_WORKLOAD_RUNTIME_WASM_WASI,
CONST_NODE_PROVISIONING_MODE_MANUAL,
CONST_NODE_PROVISIONING_MODE_AUTO,
CONST_NODE_PROVISIONING_DEFAULT_POOLS_AUTO,
CONST_NODE_PROVISIONING_DEFAULT_POOLS_NONE,
CONST_MANAGED_CLUSTER_SKU_NAME_BASE,
CONST_MANAGED_CLUSTER_SKU_NAME_AUTOMATIC,
CONST_SSH_ACCESS_LOCALUSER,
Expand Down Expand Up @@ -456,12 +458,16 @@
CONST_EPHEMERAL_NVME_PERF_TIER_STANDARD,
]

# consts for guardrails level
node_provisioning_modes = [
CONST_NODE_PROVISIONING_MODE_MANUAL,
CONST_NODE_PROVISIONING_MODE_AUTO,
]

node_provisioning_default_pools = [
CONST_NODE_PROVISIONING_DEFAULT_POOLS_AUTO,
CONST_NODE_PROVISIONING_DEFAULT_POOLS_NONE,
]

ssh_accesses = [
CONST_SSH_ACCESS_LOCALUSER,
CONST_SSH_ACCESS_DISABLED,
Expand Down Expand Up @@ -1016,6 +1022,20 @@ def load_arguments(self, _):
'For more information on "Auto" mode see aka.ms/aks/nap.'
)
)
c.argument(
"node_provisioning_default_pools",
is_preview=True,
arg_type=get_enum_type(node_provisioning_default_pools),
help=(
'The set of default Karpenter NodePools configured for node provisioning. '
'Valid values are "Auto" and "None". Auto: A standard set of Karpenter NodePools are provisioned. '
'None: No Karpenter NodePools are provisioned. '
'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.'
)
)
# in creation scenario, use "localuser" as default
c.argument(
'ssh_access',
Expand Down Expand Up @@ -1461,6 +1481,20 @@ def load_arguments(self, _):
'For more information on "Auto" mode see aka.ms/aks/nap.'
)
)
c.argument(
"node_provisioning_default_pools",
is_preview=True,
arg_type=get_enum_type(node_provisioning_default_pools),
help=(
'The set of default Karpenter NodePools configured for node provisioning. '
'Valid values are "Auto" and "None". Auto: A standard set of Karpenter NodePools are provisioned. '
'None: No Karpenter NodePools are provisioned. '
'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.'
)
)
c.argument('enable_static_egress_gateway', is_preview=True, action='store_true')
c.argument('disable_static_egress_gateway', is_preview=True, action='store_true')
c.argument("enable_imds_restriction", action="store_true", is_preview=True)
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 @@ -718,6 +718,7 @@ def aks_create(
ephemeral_disk_volume_type=None,
ephemeral_disk_nvme_perf_tier=None,
node_provisioning_mode=None,
node_provisioning_default_pools=None,
ssh_access=CONST_SSH_ACCESS_LOCALUSER,
# trusted launch
enable_secure_boot=False,
Expand Down Expand Up @@ -933,6 +934,7 @@ def aks_update(
ephemeral_disk_volume_type=None,
ephemeral_disk_nvme_perf_tier=None,
node_provisioning_mode=None,
node_provisioning_default_pools=None,
cluster_service_load_balancer_health_probe_mode=None,
if_match=None,
if_none_match=None,
Expand Down
37 changes: 37 additions & 0 deletions src/aks-preview/azext_aks_preview/managed_cluster_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2749,6 +2749,11 @@ def get_node_provisioning_mode(self) -> Union[str, None]:
"""
return self.raw_param.get("node_provisioning_mode")

def get_node_provisioning_default_pools(self) -> Union[str, None]:
"""Obtain the value of node_provisioning_default_pools.
"""
return self.raw_param.get("node_provisioning_default_pools")

def get_ai_toolchain_operator(self, enable_validation: bool = False) -> bool:
"""Internal function to obtain the value of enable_ai_toolchain_operator.

Expand Down Expand Up @@ -3542,10 +3547,26 @@ def set_up_node_provisioning_mode(self, mc: ManagedCluster) -> ManagedCluster:

return mc

def set_up_node_provisioning_default_pools(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)

default_pools = self.context.get_node_provisioning_default_pools()
if default_pools is not None:
if mc.node_provisioning_profile is None:
mc.node_provisioning_profile = (
self.models.ManagedClusterNodeProvisioningProfile() # pylint: disable=no-member
)

# set default_node_pools
mc.node_provisioning_profile.default_node_pools = default_pools

return mc

def set_up_node_provisioning_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)

mc = self.set_up_node_provisioning_mode(mc)
mc = self.set_up_node_provisioning_default_pools(mc)

return mc

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

return mc

def update_node_provisioning_default_pools(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)

default_pools = self.context.get_node_provisioning_default_pools()
if default_pools is not None:
if mc.node_provisioning_profile is None:
mc.node_provisioning_profile = (
self.models.ManagedClusterNodeProvisioningProfile() # pylint: disable=no-member
)

# set default_node_pools
mc.node_provisioning_profile.default_node_pools = default_pools

return mc

# pylint: disable=too-many-branches
def update_app_routing_profile(self, mc: ManagedCluster) -> ManagedCluster:
"""Update app routing profile for the ManagedCluster object.
Expand Down Expand Up @@ -5222,6 +5258,7 @@ def update_node_provisioning_profile(self, mc: ManagedCluster) -> ManagedCluster
self._ensure_mc(mc)

mc = self.update_node_provisioning_mode(mc)
mc = self.update_node_provisioning_default_pools(mc)

return mc

Expand Down
Loading
Loading