Skip to content

Commit db8472d

Browse files
authored
[AKS] az aks create/update: Add new parameter --enable-ai-toolchain-operator to enable Kaito addon (#31485)
1 parent e4b6e96 commit db8472d

File tree

9 files changed

+3376
-0
lines changed

9 files changed

+3376
-0
lines changed

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
@@ -590,6 +590,9 @@
590590
short-summary: Configure artifact source when bootstraping the cluster.
591591
long-summary: |
592592
The artifacts include the addon image. Use "Direct" to download artifacts from MCR, "Cache" to downalod artifacts from Azure Container Registry.
593+
- name: --enable-ai-toolchain-operator
594+
type: bool
595+
short-summary: Enable AI toolchain operator to the cluster.
593596
- name: --bootstrap-container-registry-resource-id
594597
type: string
595598
short-summary: Configure container registry resource ID. Must use "Cache" as bootstrap artifact source.
@@ -1048,6 +1051,12 @@
10481051
short-summary: Configure artifact source when bootstraping the cluster.
10491052
long-summary: |
10501053
The artifacts include the addon image. Use "Direct" to download artifacts from MCR, "Cache" to downalod artifacts from Azure Container Registry.
1054+
- name: --enable-ai-toolchain-operator
1055+
type: bool
1056+
short-summary: Enable AI toolchain operator to the cluster
1057+
- name: --disable-ai-toolchain-operator
1058+
type: bool
1059+
short-summary: Disable AI toolchain operator.
10511060
- name: --bootstrap-container-registry-resource-id
10521061
type: string
10531062
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
@@ -434,6 +434,7 @@ def load_arguments(self, _):
434434
c.argument('rotation_poll_interval')
435435
c.argument('enable_sgxquotehelper', action='store_true')
436436
c.argument('enable_app_routing', action="store_true")
437+
c.argument('enable_ai_toolchain_operator', action='store_true')
437438
c.argument(
438439
"app_routing_default_nginx_controller",
439440
arg_type=get_enum_type(app_routing_nginx_configs),
@@ -633,6 +634,8 @@ def load_arguments(self, _):
633634
# addons
634635
c.argument('enable_secret_rotation', action='store_true')
635636
c.argument('disable_secret_rotation', action='store_true', validator=validate_keyvault_secrets_provider_disable_and_enable_parameters)
637+
c.argument('enable_ai_toolchain_operator', action='store_true')
638+
c.argument('disable_ai_toolchain_operator', action='store_true')
636639
c.argument('rotation_poll_interval')
637640
c.argument('enable_static_egress_gateway', action='store_true')
638641
c.argument('disable_static_egress_gateway', action='store_true')

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ def aks_create(
602602
enable_secret_rotation=False,
603603
rotation_poll_interval=None,
604604
enable_app_routing=False,
605+
enable_ai_toolchain_operator=False,
605606
app_routing_default_nginx_controller=None,
606607
enable_static_egress_gateway=False,
607608
# nodepool paramerters
@@ -803,6 +804,8 @@ def aks_update(
803804
# addons
804805
enable_secret_rotation=False,
805806
disable_secret_rotation=False,
807+
enable_ai_toolchain_operator=False,
808+
disable_ai_toolchain_operator=False,
806809
rotation_poll_interval=None,
807810
enable_static_egress_gateway=False,
808811
disable_static_egress_gateway=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
@@ -5414,6 +5414,32 @@ def get_upgrade_override_until(self) -> Union[str, None]:
54145414
# this parameter does not need validation
54155415
return self.raw_param.get("upgrade_override_until")
54165416

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

67736799
return mc
67746800

6801+
def set_up_ai_toolchain_operator(self, mc: ManagedCluster) -> ManagedCluster:
6802+
self._ensure_mc(mc)
6803+
6804+
if self.context.get_ai_toolchain_operator(enable_validation=True):
6805+
if mc.ai_toolchain_operator_profile is None:
6806+
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
6807+
# set enabled
6808+
mc.ai_toolchain_operator_profile.enabled = True
6809+
6810+
# Default is disabled so no need to worry about that here
6811+
return mc
6812+
67756813
def set_up_cost_analysis(self, mc: ManagedCluster) -> ManagedCluster:
67766814
self._ensure_mc(mc)
67776815

@@ -6927,6 +6965,8 @@ def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) ->
69276965
mc = self.set_up_metrics_profile(mc)
69286966
# set up node resource group profile
69296967
mc = self.set_up_node_resource_group_profile(mc)
6968+
# set up AI toolchain operator
6969+
mc = self.set_up_ai_toolchain_operator(mc)
69306970
# set up bootstrap profile
69316971
mc = self.set_up_bootstrap_profile(mc)
69326972
# set up static egress gateway profile
@@ -8709,6 +8749,23 @@ def update_azure_container_storage(self, mc: ManagedCluster) -> ManagedCluster:
87098749

87108750
return mc
87118751

8752+
def update_ai_toolchain_operator(self, mc: ManagedCluster) -> ManagedCluster:
8753+
"""Updates the aiToolchainOperatorProfile field of the managed cluster
8754+
:return: the ManagedCluster object
8755+
"""
8756+
8757+
if self.context.get_ai_toolchain_operator(enable_validation=True):
8758+
if mc.ai_toolchain_operator_profile is None:
8759+
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
8760+
mc.ai_toolchain_operator_profile.enabled = True
8761+
8762+
if self.context.get_disable_ai_toolchain_operator():
8763+
if mc.ai_toolchain_operator_profile is None:
8764+
mc.ai_toolchain_operator_profile = self.models.ManagedClusterAIToolchainOperatorProfile() # pylint: disable=no-member
8765+
mc.ai_toolchain_operator_profile.enabled = False
8766+
8767+
return mc
8768+
87128769
def update_cost_analysis(self, mc: ManagedCluster) -> ManagedCluster:
87138770
self._ensure_mc(mc)
87148771

@@ -8898,6 +8955,8 @@ def update_mc_profile_default(self) -> ManagedCluster:
88988955
mc = self.update_metrics_profile(mc)
88998956
# update node resource group profile
89008957
mc = self.update_node_resource_group_profile(mc)
8958+
# update AI toolchain operator
8959+
mc = self.update_ai_toolchain_operator(mc)
89018960
# update bootstrap profile
89028961
mc = self.update_bootstrap_profile(mc)
89038962
# update static egress gateway

0 commit comments

Comments
 (0)