|
52 | 52 | CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE, |
53 | 53 | CONST_APP_ROUTING_ISTIO_MODE_ENABLED, |
54 | 54 | CONST_APP_ROUTING_ISTIO_MODE_DISABLED, |
| 55 | + CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED, |
| 56 | + CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD, |
55 | 57 | ) |
56 | 58 | from azure.cli.command_modules.acs.azurecontainerstorage._consts import ( |
57 | 59 | CONST_ACSTOR_EXT_INSTALLATION_NAME, |
@@ -6228,6 +6230,20 @@ def get_disable_app_routing_istio(self) -> bool: |
6228 | 6230 | """ |
6229 | 6231 | return self.raw_param.get("disable_app_routing_istio", False) |
6230 | 6232 |
|
| 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 | + |
6231 | 6247 |
|
6232 | 6248 | class AKSManagedClusterCreateDecorator(BaseAKSManagedClusterDecorator): |
6233 | 6249 | def __init__( |
@@ -7764,6 +7780,19 @@ def set_up_ingress_profile_app_routing_istio(self, mc: ManagedCluster) -> Manage |
7764 | 7780 |
|
7765 | 7781 | return mc |
7766 | 7782 |
|
| 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 | + |
7767 | 7796 | def set_up_ai_toolchain_operator(self, mc: ManagedCluster) -> ManagedCluster: |
7768 | 7797 | self._ensure_mc(mc) |
7769 | 7798 |
|
@@ -7920,6 +7949,8 @@ def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) -> |
7920 | 7949 | mc = self.set_up_ingress_web_app_routing(mc) |
7921 | 7950 | # set up app routing istio |
7922 | 7951 | 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) |
7923 | 7954 | # set up custom ca trust certificates |
7924 | 7955 | mc = self.set_up_custom_ca_trust_certificates(mc) |
7925 | 7956 | # set up run command |
@@ -9471,6 +9502,31 @@ def update_ingress_profile_app_routing_istio(self, mc: ManagedCluster) -> Manage |
9471 | 9502 | ) |
9472 | 9503 | return mc |
9473 | 9504 |
|
| 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 | + |
9474 | 9530 | def update_node_resource_group_profile(self, mc: ManagedCluster) -> ManagedCluster: |
9475 | 9531 | """Update node resource group profile for the ManagedCluster object. |
9476 | 9532 | :return: the ManagedCluster object |
@@ -10411,6 +10467,8 @@ def update_mc_profile_default(self) -> ManagedCluster: |
10411 | 10467 | mc = self.update_ai_toolchain_operator(mc) |
10412 | 10468 | # update app routing istio |
10413 | 10469 | mc = self.update_ingress_profile_app_routing_istio(mc) |
| 10470 | + # update gateway api |
| 10471 | + mc = self.update_ingress_profile_gateway_api(mc) |
10414 | 10472 | # update bootstrap profile |
10415 | 10473 | mc = self.update_bootstrap_profile(mc) |
10416 | 10474 | # update static egress gateway |
|
0 commit comments