Skip to content

Commit e018f59

Browse files
meecethereeseMauricio Ferrari
andauthored
[AKS] Hotfix: az aks create/update: Add --enable-gateway-api and --disable-gateway-api parameters to manage Managed Gateway API installation (#33286)
Co-authored-by: Mauricio Ferrari <meece@MeeceSurface.localdomain>
1 parent 111c94f commit e018f59

9 files changed

Lines changed: 5800 additions & 0 deletions

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@
214214
CONST_APP_ROUTING_ISTIO_MODE_ENABLED = "Enabled"
215215
CONST_APP_ROUTING_ISTIO_MODE_DISABLED = "Disabled"
216216

217+
# managed gateway api installation
218+
CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED = "Disabled"
219+
CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD = "Standard"
220+
217221
# all supported addons
218222
ADDONS = {
219223
"http_application_routing": CONST_HTTP_APPLICATION_ROUTING_ADDON_NAME,

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@
650650
This enables an ingress-only version of Istio that reconciles Gateway API resources for App Routing.
651651
It does not provide service mesh functionality (e.g. mTLS, traffic management between services).
652652
Cannot be used simultaneously with the Istio service mesh add-on (--enable-azure-service-mesh).
653+
- name: --enable-gateway-api
654+
type: bool
655+
short-summary: Enable managed installation of Gateway API CRDs from the standard release channel.
653656
- name: --bootstrap-container-registry-resource-id
654657
type: string
655658
short-summary: Configure container registry resource ID. Must use "Cache" as bootstrap artifact source.
@@ -759,6 +762,8 @@
759762
text: az aks create -g MyResourceGroup -n MyManagedCluster --node-provisioning-mode Auto --node-provisioning-default-pools None
760763
- name: Create a Kubernetes cluster with KataVmIsolation enabled.
761764
text: az aks create -g MyResourceGroup -n MyManagedCluster --os-sku AzureLinux --vm-size Standard_D4s_v3 --workload-runtime KataVmIsolation --node-count 1
765+
- name: Create a kubernetes cluster with a managed installation of Gateway API CRDs from the standard release channel.
766+
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-gateway-api
762767
"""
763768

764769
helps["aks update"] = """
@@ -1192,6 +1197,12 @@
11921197
- name: --disable-app-routing-istio --disable-ari
11931198
type: bool
11941199
short-summary: Disable Gateway API based ingress on App Routing via Istio.
1200+
- name: --enable-gateway-api
1201+
type: bool
1202+
short-summary: Enable managed installation of Gateway API CRDs from the standard release channel.
1203+
- name: --disable-gateway-api
1204+
type: bool
1205+
short-summary: Disable managed installation of Gateway API CRDs.
11951206
- name: --bootstrap-container-registry-resource-id
11961207
type: string
11971208
short-summary: Configure container registry resource ID. Must use "Cache" as bootstrap artifact source.
@@ -1280,6 +1291,10 @@
12801291
text: az aks update -g MyResourceGroup -n MyManagedCluster --node-provisioning-mode Auto --node-provisioning-default-pools None
12811292
- name: Upgrade load balancer sku to standard
12821293
text: az aks update --load-balancer-sku standard -g MyResourceGroup -n MyManagedCluster
1294+
- name: Update a kubernetes cluster to enable a managed installation of Gateway API CRDs from the standard release channel.
1295+
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-gateway-api
1296+
- name: Update a kubernetes cluster to disable the managed installation of Gateway API CRDs.
1297+
text: az aks update -g MyResourceGroup -n MyManagedCluster --disable-gateway-api
12831298
"""
12841299

12851300
helps["aks delete"] = """

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,11 @@ def load_arguments(self, _):
661661
action="store_true",
662662
help="Enable Gateway API based ingress on App Routing via Istio"
663663
)
664+
c.argument(
665+
"enable_gateway_api",
666+
action="store_true",
667+
help="Enable managed installation of Gateway API CRDs from the standard release channel."
668+
)
664669

665670
with self.argument_context('aks update') as c:
666671
# managed cluster paramerters
@@ -898,6 +903,16 @@ def load_arguments(self, _):
898903
action="store_true",
899904
help="Disable Gateway API based ingress on App Routing via Istio."
900905
)
906+
c.argument(
907+
"enable_gateway_api",
908+
action="store_true",
909+
help="Enable managed installation of Gateway API CRDs from the standard release channel."
910+
)
911+
c.argument(
912+
"disable_gateway_api",
913+
action="store_true",
914+
help="Disable managed installation of Gateway API CRDs."
915+
)
901916
with self.argument_context('aks delete') as c:
902917
c.argument("if_match")
903918
c.argument("if_none_match")

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,8 @@ def aks_create(
10421042
node_provisioning_default_pools=None,
10431043
# app routing istio
10441044
enable_app_routing_istio=False,
1045+
# gateway api
1046+
enable_gateway_api=False,
10451047
):
10461048
# DO NOT MOVE: get all the original parameters and save them as a dictionary
10471049
raw_parameters = locals()
@@ -1240,6 +1242,9 @@ def aks_update(
12401242
# app routing istio
12411243
enable_app_routing_istio=False,
12421244
disable_app_routing_istio=False,
1245+
# gateway api
1246+
enable_gateway_api=False,
1247+
disable_gateway_api=False,
12431248
):
12441249
# DO NOT MOVE: get all the original parameters and save them as a dictionary
12451250
raw_parameters = locals()

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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE,
5353
CONST_APP_ROUTING_ISTIO_MODE_ENABLED,
5454
CONST_APP_ROUTING_ISTIO_MODE_DISABLED,
55+
CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED,
56+
CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD,
5557
)
5658
from azure.cli.command_modules.acs.azurecontainerstorage._consts import (
5759
CONST_ACSTOR_EXT_INSTALLATION_NAME,
@@ -6228,6 +6230,20 @@ def get_disable_app_routing_istio(self) -> bool:
62286230
"""
62296231
return self.raw_param.get("disable_app_routing_istio", False)
62306232

6233+
def get_enable_gateway_api(self) -> bool:
6234+
"""Obtain the value of enable_gateway_api.
6235+
6236+
:return: bool
6237+
"""
6238+
return self.raw_param.get("enable_gateway_api", False)
6239+
6240+
def get_disable_gateway_api(self) -> bool:
6241+
"""Obtain the value of disable_gateway_api.
6242+
6243+
:return: bool
6244+
"""
6245+
return self.raw_param.get("disable_gateway_api", False)
6246+
62316247

62326248
class AKSManagedClusterCreateDecorator(BaseAKSManagedClusterDecorator):
62336249
def __init__(
@@ -7764,6 +7780,19 @@ def set_up_ingress_profile_app_routing_istio(self, mc: ManagedCluster) -> Manage
77647780

77657781
return mc
77667782

7783+
def set_up_ingress_profile_gateway_api(self, mc: ManagedCluster) -> ManagedCluster:
7784+
self._ensure_mc(mc)
7785+
if self.context.get_enable_gateway_api():
7786+
if mc.ingress_profile is None:
7787+
mc.ingress_profile = self.models.ManagedClusterIngressProfile()
7788+
if mc.ingress_profile.gateway_api is None:
7789+
mc.ingress_profile.gateway_api = (
7790+
self.models.ManagedClusterIngressProfileGatewayConfiguration(
7791+
installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD
7792+
)
7793+
)
7794+
return mc
7795+
77677796
def set_up_ai_toolchain_operator(self, mc: ManagedCluster) -> ManagedCluster:
77687797
self._ensure_mc(mc)
77697798

@@ -7920,6 +7949,8 @@ def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) ->
79207949
mc = self.set_up_ingress_web_app_routing(mc)
79217950
# set up app routing istio
79227951
mc = self.set_up_ingress_profile_app_routing_istio(mc)
7952+
# set up gateway api
7953+
mc = self.set_up_ingress_profile_gateway_api(mc)
79237954
# set up custom ca trust certificates
79247955
mc = self.set_up_custom_ca_trust_certificates(mc)
79257956
# set up run command
@@ -9471,6 +9502,31 @@ def update_ingress_profile_app_routing_istio(self, mc: ManagedCluster) -> Manage
94719502
)
94729503
return mc
94739504

9505+
def update_ingress_profile_gateway_api(self, mc: ManagedCluster) -> ManagedCluster:
9506+
"""Update gateway api installation in the ingress profile for the ManagedCluster object.
9507+
9508+
:return: the ManagedCluster object
9509+
"""
9510+
self._ensure_mc(mc)
9511+
enable_gateway_api = self.context.get_enable_gateway_api()
9512+
disable_gateway_api = self.context.get_disable_gateway_api()
9513+
if enable_gateway_api and disable_gateway_api:
9514+
raise MutuallyExclusiveArgumentError(
9515+
"Cannot specify --enable-gateway-api and --disable-gateway-api at the same time."
9516+
)
9517+
if enable_gateway_api or disable_gateway_api:
9518+
if mc.ingress_profile is None:
9519+
mc.ingress_profile = self.models.ManagedClusterIngressProfile() # pylint: disable=no-member
9520+
if mc.ingress_profile.gateway_api is None:
9521+
mc.ingress_profile.gateway_api = (
9522+
self.models.ManagedClusterIngressProfileGatewayConfiguration() # pylint: disable=no-member
9523+
)
9524+
if enable_gateway_api:
9525+
mc.ingress_profile.gateway_api.installation = CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD
9526+
elif disable_gateway_api:
9527+
mc.ingress_profile.gateway_api.installation = CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED
9528+
return mc
9529+
94749530
def update_node_resource_group_profile(self, mc: ManagedCluster) -> ManagedCluster:
94759531
"""Update node resource group profile for the ManagedCluster object.
94769532
:return: the ManagedCluster object
@@ -10411,6 +10467,8 @@ def update_mc_profile_default(self) -> ManagedCluster:
1041110467
mc = self.update_ai_toolchain_operator(mc)
1041210468
# update app routing istio
1041310469
mc = self.update_ingress_profile_app_routing_istio(mc)
10470+
# update gateway api
10471+
mc = self.update_ingress_profile_gateway_api(mc)
1041410472
# update bootstrap profile
1041510473
mc = self.update_bootstrap_profile(mc)
1041610474
# update static egress gateway

0 commit comments

Comments
 (0)