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

Pending
+++++++

1.0.0b5
+++++++
* Add `--enable-ai-toolchain-operator` to `az aks create` and `az aks update`.
* Add `--disable-ai-toolchain-operator` to the `az aks update` command.

* Deprecate the alias "-r" of parameter --source-resource-id in `az aks trustedaccess rolebinding create`
* Refactor azure service mesh related code to meet cli style requirements.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
],
"service mesh, missing feature registration for new resource type": [
"test_aks_azure_service_mesh_get_revisions"
],
"ai toolchain operator, enabled in staging only": [
"test_aks_create_with_enable_ai_toolchain_operator",
"test_aks_update_with_enable_ai_toolchain_operator"
]
}
}
}
9 changes: 9 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,9 @@
- name: --enable-app-routing
type: bool
short-summary: Enable Application Routing addon.
- name: --enable-ai-toolchain-operator
type: bool
short-summary: Enable AI toolchain operator to the cluster.
examples:
- name: Create a Kubernetes cluster with an existing SSH public key.
text: az aks create -g MyResourceGroup -n MyManagedCluster --ssh-key-value /path/to/publickey
Expand Down Expand Up @@ -1133,6 +1136,12 @@
- 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: --enable-ai-toolchain-operator
type: bool
short-summary: Enable AI toolchain operator to the cluster
- name: --disable-ai-toolchain-operator
type: bool
short-summary: Disable AI toolchain operator.
examples:
- name: Reconcile the cluster back to its current state.
text: az aks update -g MyResourceGroup -n MyManagedCluster
Expand Down
3 changes: 3 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ def load_arguments(self, _):
c.argument("grafana_resource_id", validator=validate_grafanaresourceid)
c.argument("enable_windows_recording_rules", action="store_true")
c.argument("enable_cost_analysis", is_preview=True, action="store_true")
c.argument('enable_ai_toolchain_operator', is_preview=True, action='store_true')
# azure container storage
c.argument(
"enable_azure_container_storage",
Expand Down Expand Up @@ -1146,6 +1147,8 @@ def load_arguments(self, _):
)
c.argument("enable_cost_analysis", is_preview=True, action="store_true")
c.argument("disable_cost_analysis", is_preview=True, action="store_true")
c.argument('enable_ai_toolchain_operator', is_preview=True, action='store_true')
c.argument('disable_ai_toolchain_operator', is_preview=True, action='store_true')
# azure container storage
c.argument(
"enable_azure_container_storage",
Expand Down
5 changes: 5 additions & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ def aks_create(
enable_windows_recording_rules=False,
# metrics profile
enable_cost_analysis=False,
# AI toolchain operator
enable_ai_toolchain_operator=False,
# azure container storage
enable_azure_container_storage=None,
storage_pool_name=None,
Expand Down Expand Up @@ -790,6 +792,9 @@ def aks_update(
# metrics profile
enable_cost_analysis=False,
disable_cost_analysis=False,
# AI toolchain operator
enable_ai_toolchain_operator=False,
disable_ai_toolchain_operator=False,
# azure container storage
enable_azure_container_storage=None,
disable_azure_container_storage=False,
Expand Down
63 changes: 63 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 @@ -2601,6 +2601,35 @@ def get_node_provisioning_mode(self) -> Union[str, None]:
"""
return self.raw_param.get("node_provisioning_mode")

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

When enabled, if both enable_ai_toolchain_operator and
disable_ai_toolchain_operator are specified, raise
a MutuallyExclusiveArgumentError.

:return: bool
"""
enable_ai_toolchain_operator = self.raw_param.get("enable_ai_toolchain_operator")
# This parameter does not need dynamic completion.
if enable_validation:
if enable_ai_toolchain_operator and self.get_disable_ai_toolchain_operator():
raise MutuallyExclusiveArgumentError(
"Cannot specify --enable-ai-toolchain-operator and "
"--disable-ai-toolchain-operator at the same time. "
)

return enable_ai_toolchain_operator

def get_disable_ai_toolchain_operator(self) -> bool:
"""Obtain the value of disable_ai_toolchain_operator.

:return: bool
"""
# Note: No need to check for mutually exclusive parameter with enable-ai-toolchain-operator here
# because it's already checked in get_ai_toolchain_operator
return self.raw_param.get("disable_ai_toolchain_operator")


# pylint: disable=too-many-public-methods
class AKSPreviewManagedClusterCreateDecorator(AKSManagedClusterCreateDecorator):
Expand Down Expand Up @@ -3184,6 +3213,18 @@ def set_up_node_provisioning_profile(self, mc: ManagedCluster) -> ManagedCluster

return mc

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

if self.context.get_ai_toolchain_operator(enable_validation=True):
if mc.ai_toolchain_operator_profile is None:
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
# set enabled
mc.ai_toolchain_operator_profile.enabled = True

# Default is disabled so no need to worry about that here
return mc

# pylint: disable=unused-argument
def construct_mc_profile_preview(self, bypass_restore_defaults: bool = False) -> ManagedCluster:
"""The overall controller used to construct the default ManagedCluster profile.
Expand Down Expand Up @@ -3236,6 +3277,8 @@ def construct_mc_profile_preview(self, bypass_restore_defaults: bool = False) ->
mc = self.set_up_azure_monitor_profile(mc)
# set up metrics profile
mc = self.set_up_metrics_profile(mc)
# set up AI toolchain operator
mc = self.set_up_ai_toolchain_operator(mc)
# set up for azure container storage
mc = self.set_up_azure_container_storage(mc)
# set up node provisioning profile
Expand Down Expand Up @@ -4497,6 +4540,24 @@ def update_node_provisioning_profile(self, mc: ManagedCluster) -> ManagedCluster

return mc

def update_ai_toolchain_operator(self, mc: ManagedCluster) -> ManagedCluster:
"""Updates the aiToolchainOperatorProfile field of the managed cluster

:return: the ManagedCluster object
"""

if self.context.get_ai_toolchain_operator(enable_validation=True):
if mc.ai_toolchain_operator_profile is None:
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
mc.ai_toolchain_operator_profile.enabled = True

if self.context.get_disable_ai_toolchain_operator():
if mc.ai_toolchain_operator_profile is None:
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
mc.ai_toolchain_operator_profile.enabled = False

return mc

def update_mc_profile_preview(self) -> ManagedCluster:
"""The overall controller used to update the preview ManagedCluster profile.

Expand Down Expand Up @@ -4558,6 +4619,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
mc = self.update_k8s_support_plan(mc)
# update metrics profile
mc = self.update_metrics_profile(mc)
# update AI toolchain operator
mc = self.update_ai_toolchain_operator(mc)
# update azure container storage
mc = self.update_azure_container_storage(mc)
# update node provisioning profile
Expand Down
Loading