Skip to content

Commit 5f413ae

Browse files
committed
Add AI Toolchain Operator (Kaito) to AKS CLI
Signed-off-by: Heba <31887807+helayoty@users.noreply.github.com>
1 parent e9f92bc commit 5f413ae

9 files changed

Lines changed: 1000 additions & 0 deletions

linter_exclusions.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ aks create:
285285
azure_keyvault_kms_key_vault_network_access:
286286
rule_exclusions:
287287
- option_length_too_long
288+
enable_ai_toolchain_operator:
289+
rule_exclusions:
290+
- option_length_too_long
288291
azure_keyvault_kms_key_vault_resource_id:
289292
rule_exclusions:
290293
- option_length_too_long
@@ -362,6 +365,12 @@ aks update:
362365
azure_keyvault_kms_key_vault_network_access:
363366
rule_exclusions:
364367
- option_length_too_long
368+
enable_ai_toolchain_operator:
369+
rule_exclusions:
370+
- option_length_too_long
371+
disable_ai_toolchain_operator:
372+
rule_exclusions:
373+
- option_length_too_long
365374
azure_keyvault_kms_key_vault_resource_id:
366375
rule_exclusions:
367376
- option_length_too_long

src/azure-cli/azure/cli/command_modules/acs/_help.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,9 @@
581581
short-summary: Configure artifact source when bootstraping the cluster.
582582
long-summary: |
583583
The artifacts include the addon image. Use "Direct" to download artifacts from MCR, "Cache" to downalod artifacts from Azure Container Registry.
584+
- name: --enable-ai-toolchain-operator
585+
type: bool
586+
short-summary: Enable AI toolchain operator to the cluster.
584587
- name: --bootstrap-container-registry-resource-id
585588
type: string
586589
short-summary: Configure container registry resource ID. Must use "Cache" as bootstrap artifact source.
@@ -1033,6 +1036,12 @@
10331036
short-summary: Configure artifact source when bootstraping the cluster.
10341037
long-summary: |
10351038
The artifacts include the addon image. Use "Direct" to download artifacts from MCR, "Cache" to downalod artifacts from Azure Container Registry.
1039+
- name: --enable-ai-toolchain-operator
1040+
type: bool
1041+
short-summary: Enable AI toolchain operator to the cluster
1042+
- name: --disable-ai-toolchain-operator
1043+
type: bool
1044+
short-summary: Disable AI toolchain operator.
10361045
- name: --bootstrap-container-registry-resource-id
10371046
type: string
10381047
short-summary: Configure container registry resource ID. Must use "Cache" as bootstrap artifact source.

src/azure-cli/azure/cli/command_modules/acs/_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ def load_arguments(self, _):
429429
c.argument('rotation_poll_interval')
430430
c.argument('enable_sgxquotehelper', action='store_true')
431431
c.argument('enable_app_routing', action="store_true")
432+
c.argument('enable_ai_toolchain_operator', is_preview=True, action='store_true')
432433
c.argument(
433434
"app_routing_default_nginx_controller",
434435
arg_type=get_enum_type(app_routing_nginx_configs),
@@ -625,6 +626,8 @@ def load_arguments(self, _):
625626
# addons
626627
c.argument('enable_secret_rotation', action='store_true')
627628
c.argument('disable_secret_rotation', action='store_true', validator=validate_keyvault_secrets_provider_disable_and_enable_parameters)
629+
c.argument('enable_ai_toolchain_operator', is_preview=True, action='store_true')
630+
c.argument('disable_ai_toolchain_operator', is_preview=True, action='store_true')
628631
c.argument('rotation_poll_interval')
629632
# nodepool paramerters
630633
c.argument('enable_cluster_autoscaler', options_list=[

src/azure-cli/azure/cli/command_modules/acs/custom.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ def aks_create(
601601
enable_secret_rotation=False,
602602
rotation_poll_interval=None,
603603
enable_app_routing=False,
604+
enable_ai_toolchain_operator=False,
604605
app_routing_default_nginx_controller=None,
605606
# nodepool paramerters
606607
nodepool_name="nodepool1",
@@ -799,6 +800,8 @@ def aks_update(
799800
# addons
800801
enable_secret_rotation=False,
801802
disable_secret_rotation=False,
803+
enable_ai_toolchain_operator=False,
804+
disable_ai_toolchain_operator=False,
802805
rotation_poll_interval=None,
803806
# nodepool paramerters
804807
enable_cluster_autoscaler=False,

src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5412,6 +5412,32 @@ def get_upgrade_override_until(self) -> Union[str, None]:
54125412
# this parameter does not need validation
54135413
return self.raw_param.get("upgrade_override_until")
54145414

5415+
def get_ai_toolchain_operator(self, enable_validation: bool = False) -> bool:
5416+
"""Internal function to obtain the value of enable_ai_toolchain_operator.
5417+
When enabled, if both enable_ai_toolchain_operator and
5418+
disable_ai_toolchain_operator are specified, raise
5419+
a MutuallyExclusiveArgumentError.
5420+
:return: bool
5421+
"""
5422+
enable_ai_toolchain_operator = self.raw_param.get("enable_ai_toolchain_operator")
5423+
# This parameter does not need dynamic completion.
5424+
if enable_validation:
5425+
if enable_ai_toolchain_operator and self.get_disable_ai_toolchain_operator():
5426+
raise MutuallyExclusiveArgumentError(
5427+
"Cannot specify --enable-ai-toolchain-operator and "
5428+
"--disable-ai-toolchain-operator at the same time. "
5429+
)
5430+
5431+
return enable_ai_toolchain_operator
5432+
5433+
def get_disable_ai_toolchain_operator(self) -> bool:
5434+
"""Obtain the value of disable_ai_toolchain_operator.
5435+
:return: bool
5436+
"""
5437+
# Note: No need to check for mutually exclusive parameter with enable-ai-toolchain-operator here
5438+
# because it's already checked in get_ai_toolchain_operator
5439+
return self.raw_param.get("disable_ai_toolchain_operator")
5440+
54155441
def _get_enable_cost_analysis(self, enable_validation: bool = False) -> bool:
54165442
"""Internal function to obtain the value of enable_cost_analysis.
54175443
When enabled, if both enable_cost_analysis and disable_cost_analysis are
@@ -6733,6 +6759,18 @@ def set_up_ingress_web_app_routing(self, mc: ManagedCluster) -> ManagedCluster:
67336759

67346760
return mc
67356761

6762+
def set_up_ai_toolchain_operator(self, mc: ManagedCluster) -> ManagedCluster:
6763+
self._ensure_mc(mc)
6764+
6765+
if self.context.get_ai_toolchain_operator(enable_validation=True):
6766+
if mc.ai_toolchain_operator_profile is None:
6767+
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
6768+
# set enabled
6769+
mc.ai_toolchain_operator_profile.enabled = True
6770+
6771+
# Default is disabled so no need to worry about that here
6772+
return mc
6773+
67366774
def set_up_cost_analysis(self, mc: ManagedCluster) -> ManagedCluster:
67376775
self._ensure_mc(mc)
67386776

@@ -6869,6 +6907,8 @@ def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) ->
68696907
mc = self.set_up_metrics_profile(mc)
68706908
# set up node resource group profile
68716909
mc = self.set_up_node_resource_group_profile(mc)
6910+
# set up AI toolchain operator
6911+
mc = self.set_up_ai_toolchain_operator(mc)
68726912
# set up bootstrap profile
68736913
mc = self.set_up_bootstrap_profile(mc)
68746914

@@ -8649,6 +8689,23 @@ def update_azure_container_storage(self, mc: ManagedCluster) -> ManagedCluster:
86498689

86508690
return mc
86518691

8692+
def update_ai_toolchain_operator(self, mc: ManagedCluster) -> ManagedCluster:
8693+
"""Updates the aiToolchainOperatorProfile field of the managed cluster
8694+
:return: the ManagedCluster object
8695+
"""
8696+
8697+
if self.context.get_ai_toolchain_operator(enable_validation=True):
8698+
if mc.ai_toolchain_operator_profile is None:
8699+
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
8700+
mc.ai_toolchain_operator_profile.enabled = True
8701+
8702+
if self.context.get_disable_ai_toolchain_operator():
8703+
if mc.ai_toolchain_operator_profile is None:
8704+
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
8705+
mc.ai_toolchain_operator_profile.enabled = False
8706+
8707+
return mc
8708+
86528709
def update_cost_analysis(self, mc: ManagedCluster) -> ManagedCluster:
86538710
self._ensure_mc(mc)
86548711

@@ -8781,6 +8838,8 @@ def update_mc_profile_default(self) -> ManagedCluster:
87818838
mc = self.update_metrics_profile(mc)
87828839
# update node resource group profile
87838840
mc = self.update_node_resource_group_profile(mc)
8841+
# update AI toolchain operator
8842+
mc = self.update_ai_toolchain_operator(mc)
87848843
# update bootstrap profile
87858844
mc = self.update_bootstrap_profile(mc)
87868845
# update kubernetes version and orchestrator version
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- application/json
7+
Accept-Encoding:
8+
- gzip, deflate
9+
CommandName:
10+
- aks create
11+
Connection:
12+
- keep-alive
13+
ParameterSetName:
14+
- --resource-group --name --location --ssh-key-value --node-count --enable-managed-identity
15+
--enable-oidc-issuer --enable-ai-toolchain-operator --aks-custom-headers
16+
User-Agent:
17+
- AZURECLI/2.73.0 azsdk-python-core/1.31.0 Python/3.12.1 (Linux-6.8.0-1027-azure-x86_64-with-glibc2.31)
18+
method: GET
19+
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001?api-version=2025-02-01
20+
response:
21+
body:
22+
string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.ContainerService/managedClusters/cliakstest000001''
23+
under resource group ''clitest000001'' was not found. For more details please
24+
go to https://aka.ms/ARMResourceNotFoundFix"}}'
25+
headers:
26+
cache-control:
27+
- no-cache
28+
content-length:
29+
- '244'
30+
content-type:
31+
- application/json; charset=utf-8
32+
date:
33+
- Fri, 16 May 2025 03:04:39 GMT
34+
expires:
35+
- '-1'
36+
pragma:
37+
- no-cache
38+
strict-transport-security:
39+
- max-age=31536000; includeSubDomains
40+
x-cache:
41+
- CONFIG_NOCACHE
42+
x-content-type-options:
43+
- nosniff
44+
x-ms-failure-cause:
45+
- gateway
46+
x-msedge-ref:
47+
- 'Ref A: CD7E65FD6D224333A54AF87AA670C89E Ref B: SJC211051204039 Ref C: 2025-05-16T03:04:39Z'
48+
status:
49+
code: 404
50+
message: Not Found
51+
version: 1

0 commit comments

Comments
 (0)