diff --git a/src/azure-cli/azure/cli/command_modules/acs/_consts.py b/src/azure-cli/azure/cli/command_modules/acs/_consts.py index 2e80089f8e7..94fc138412c 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/_consts.py +++ b/src/azure-cli/azure/cli/command_modules/acs/_consts.py @@ -209,6 +209,10 @@ CONST_APP_ROUTING_INTERNAL_NGINX = "Internal" CONST_APP_ROUTING_NONE_NGINX = "None" +# managed gateway api installation +CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED = "Disabled" +CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD = "Standard" + # all supported addons ADDONS = { "http_application_routing": CONST_HTTP_APPLICATION_ROUTING_ADDON_NAME, diff --git a/src/azure-cli/azure/cli/command_modules/acs/_help.py b/src/azure-cli/azure/cli/command_modules/acs/_help.py index 7a89268ed9f..cf3bb1b067a 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/_help.py +++ b/src/azure-cli/azure/cli/command_modules/acs/_help.py @@ -616,6 +616,9 @@ - name: --enable-ai-toolchain-operator type: bool short-summary: Enable AI toolchain operator to the cluster. + - name: --enable-gateway-api + type: bool + short-summary: Enable managed installation of Gateway API CRDs from the standard release channel. - name: --bootstrap-container-registry-resource-id type: string short-summary: Configure container registry resource ID. Must use "Cache" as bootstrap artifact source. @@ -725,6 +728,8 @@ text: az aks create -g MyResourceGroup -n MyManagedCluster --node-provisioning-mode Auto --node-provisioning-default-pools None - name: Create a Kubernetes cluster with KataVmIsolation enabled. text: az aks create -g MyResourceGroup -n MyManagedCluster --os-sku AzureLinux --vm-size Standard_D4s_v3 --workload-runtime KataVmIsolation --node-count 1 + - name: Create a kubernetes cluster with a managed installation of Gateway API CRDs from the standard release channel. + text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-gateway-api """ helps["aks update"] = """ @@ -1142,6 +1147,12 @@ - name: --disable-ai-toolchain-operator type: bool short-summary: Disable AI toolchain operator. + - name: --enable-gateway-api + type: bool + short-summary: Enable managed installation of Gateway API CRDs from the standard release channel. + - name: --disable-gateway-api + type: bool + short-summary: Disable managed installation of Gateway API CRDs. - name: --bootstrap-container-registry-resource-id type: string short-summary: Configure container registry resource ID. Must use "Cache" as bootstrap artifact source. @@ -1230,6 +1241,10 @@ text: az aks update -g MyResourceGroup -n MyManagedCluster --node-provisioning-mode Auto --node-provisioning-default-pools None - name: Upgrade load balancer sku to standard text: az aks update --load-balancer-sku standard -g MyResourceGroup -n MyManagedCluster + - name: Update a kubernetes cluster to enable a managed installation of Gateway API CRDs from the standard release channel. + text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-gateway-api + - name: Update a kubernetes cluster to disable the managed installation of Gateway API CRDs. + text: az aks update -g MyResourceGroup -n MyManagedCluster --disable-gateway-api """ helps["aks delete"] = """ diff --git a/src/azure-cli/azure/cli/command_modules/acs/_params.py b/src/azure-cli/azure/cli/command_modules/acs/_params.py index 49e2d17f585..11b6a133a0f 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/_params.py +++ b/src/azure-cli/azure/cli/command_modules/acs/_params.py @@ -650,6 +650,12 @@ def load_arguments(self, _): 'by that action.' ) ) + c.argument( + "enable_gateway_api", + action="store_true", + help="Enable managed installation of Gateway API CRDs from the standard release channel. " + "Requires a Gateway API implementation to be installed on the cluster (e.g., Azure Service Mesh)." + ) with self.argument_context('aks update') as c: # managed cluster paramerters @@ -873,6 +879,17 @@ def load_arguments(self, _): 'by that action.' ) ) + c.argument( + "enable_gateway_api", + action="store_true", + help="Enable managed installation of Gateway API CRDs from the standard release channel. " + "Requires a Gateway API implementation to be installed on the cluster (e.g., Azure Service Mesh)." + ) + c.argument( + "disable_gateway_api", + action="store_true", + help="Disable managed installation of Gateway API CRDs." + ) with self.argument_context('aks delete') as c: c.argument("if_match") c.argument("if_none_match") diff --git a/src/azure-cli/azure/cli/command_modules/acs/custom.py b/src/azure-cli/azure/cli/command_modules/acs/custom.py index b0d7ece1360..cd11ab26617 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/custom.py @@ -1035,6 +1035,8 @@ def aks_create( # node provisioning node_provisioning_mode=None, node_provisioning_default_pools=None, + # gateway api + enable_gateway_api=False, ): # DO NOT MOVE: get all the original parameters and save them as a dictionary raw_parameters = locals() @@ -1228,6 +1230,9 @@ def aks_update( # node provisioning node_provisioning_mode=None, node_provisioning_default_pools=None, + # gateway api + enable_gateway_api=False, + disable_gateway_api=False, ): # DO NOT MOVE: get all the original parameters and save them as a dictionary raw_parameters = locals() diff --git a/src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py b/src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py index b24a7262f56..df5da7e88f3 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py +++ b/src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py @@ -49,7 +49,9 @@ CONST_AVAILABILITY_SET, CONST_VIRTUAL_MACHINES, CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH, - CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE + CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE, + CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED, + CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD, ) from azure.cli.command_modules.acs.azurecontainerstorage._consts import ( CONST_ACSTOR_EXT_INSTALLATION_NAME, @@ -5973,6 +5975,20 @@ def get_node_provisioning_default_pools(self) -> Union[str, None]: """ return self.raw_param.get("node_provisioning_default_pools") + def get_enable_gateway_api(self) -> bool: + """Obtain the value of enable_gateway_api. + + :return: bool + """ + return self.raw_param.get("enable_gateway_api", False) + + def get_disable_gateway_api(self) -> bool: + """Obtain the value of disable_gateway_api. + + :return: bool + """ + return self.raw_param.get("disable_gateway_api", False) + class AKSManagedClusterCreateDecorator(BaseAKSManagedClusterDecorator): def __init__( @@ -7362,6 +7378,19 @@ def set_up_ingress_web_app_routing(self, mc: ManagedCluster) -> ManagedCluster: return mc + def set_up_ingress_profile_gateway_api(self, mc: ManagedCluster) -> ManagedCluster: + self._ensure_mc(mc) + if self.context.get_enable_gateway_api(): + if mc.ingress_profile is None: + mc.ingress_profile = self.models.ManagedClusterIngressProfile() + if mc.ingress_profile.gateway_api is None: + mc.ingress_profile.gateway_api = ( + self.models.ManagedClusterIngressProfileGatewayConfiguration( + installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD + ) + ) + return mc + def set_up_ai_toolchain_operator(self, mc: ManagedCluster) -> ManagedCluster: self._ensure_mc(mc) @@ -7514,6 +7543,8 @@ def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) -> mc = self.set_up_workload_auto_scaler_profile(mc) # set up app routing profile mc = self.set_up_ingress_web_app_routing(mc) + # set up gateway api + mc = self.set_up_ingress_profile_gateway_api(mc) # set up custom ca trust certificates mc = self.set_up_custom_ca_trust_certificates(mc) # set up run command @@ -9011,6 +9042,31 @@ def _update_app_routing_nginx(self, mc: ManagedCluster, nginx) -> None: else: raise CLIError('App Routing must be enabled to modify the default nginx ingress controller.\n') + def update_ingress_profile_gateway_api(self, mc: ManagedCluster) -> ManagedCluster: + """Update gateway api installation in the ingress profile for the ManagedCluster object. + + :return: the ManagedCluster object + """ + self._ensure_mc(mc) + enable_gateway_api = self.context.get_enable_gateway_api() + disable_gateway_api = self.context.get_disable_gateway_api() + if enable_gateway_api and disable_gateway_api: + raise MutuallyExclusiveArgumentError( + "Cannot specify --enable-gateway-api and --disable-gateway-api at the same time." + ) + if enable_gateway_api or disable_gateway_api: + if mc.ingress_profile is None: + mc.ingress_profile = self.models.ManagedClusterIngressProfile() # pylint: disable=no-member + if mc.ingress_profile.gateway_api is None: + mc.ingress_profile.gateway_api = ( + self.models.ManagedClusterIngressProfileGatewayConfiguration() # pylint: disable=no-member + ) + if enable_gateway_api: + mc.ingress_profile.gateway_api.installation = CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD + elif disable_gateway_api: + mc.ingress_profile.gateway_api.installation = CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED + return mc + def update_node_resource_group_profile(self, mc: ManagedCluster) -> ManagedCluster: """Update node resource group profile for the ManagedCluster object. :return: the ManagedCluster object @@ -9928,6 +9984,8 @@ def update_mc_profile_default(self) -> ManagedCluster: mc = self.update_node_resource_group_profile(mc) # update AI toolchain operator mc = self.update_ai_toolchain_operator(mc) + # update gateway api + mc = self.update_ingress_profile_gateway_api(mc) # update bootstrap profile mc = self.update_bootstrap_profile(mc) # update static egress gateway diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py index 93ee3ef724c..8f932a86ba0 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py @@ -15051,3 +15051,150 @@ def test_aks_nodepool_add_with_localdns_required_mode(self, resource_group, reso "aks delete --resource-group={resource_group} --name={name} --yes --no-wait", checks=[self.is_empty()], ) + + @AllowLargeResponse() + @AKSCustomResourceGroupPreparer( + random_name_length=17, name_prefix="clitest", location="centraluseuap" + ) + def test_aks_create_with_gateway_api_and_azureservicemesh( + self, resource_group, resource_group_location + ): + # reset the count so in replay mode the random names will start with 0 + self.test_resources_count = 0 + + aks_name = self.create_random_name("cliakstest", 16) + _, create_version = self._get_versions(resource_group_location) + asm_revision = self._get_asm_supported_revision(resource_group_location) + self.kwargs.update( + { + "resource_group": resource_group, + "name": aks_name, + "ssh_key_value": self.generate_ssh_keys(), + "k8s_version": create_version, + "asm_revision": asm_revision, + } + ) + + # Test successful creation with Gateway API and Azure Service Mesh addon + create_cmd = ( + "aks create --resource-group={resource_group} --name={name} " + "--enable-app-routing " + "--enable-azure-service-mesh " + "--enable-gateway-api " + "--ssh-key-value={ssh_key_value} -o json " + ) + self.cmd( + create_cmd, + checks=[ + self.check("provisioningState", "Succeeded"), + self.check("serviceMeshProfile.mode", "Istio"), + self.check("ingressProfile.gatewayApi.installation", "Standard"), + ], + ) + + # Test disabling Gateway API + update_cmd = ( + "aks update --resource-group={resource_group} --name={name} " + "--disable-gateway-api " + ) + self.cmd( + update_cmd, + checks=[ + self.check("provisioningState", "Succeeded"), + self.check("ingressProfile.gatewayApi.installation", "Disabled"), + ], + ) + + # Test re-enabling Gateway API + update_cmd = ( + "aks update --resource-group={resource_group} --name={name} " + "--enable-gateway-api " + ) + self.cmd( + update_cmd, + checks=[ + self.check("provisioningState", "Succeeded"), + self.check("ingressProfile.gatewayApi.installation", "Standard"), + ], + ) + + # Cleanup + self.cmd( + "aks delete --resource-group={resource_group} --name={name} --yes --no-wait", + checks=[self.is_empty()], + ) + + + @AllowLargeResponse() + @AKSCustomResourceGroupPreparer( + random_name_length=17, name_prefix="clitest", location="centraluseuap" + ) + def test_aks_managed_gateway_without_gateway_implementation( + self, resource_group, resource_group_location + ): + """ + Verify that managed Gateway API can be enabled without a Gateway API implementation + (e.g., Azure Service Mesh) on the cluster. + + This test: + - Creates a cluster with --enable-gateway-api but no gateway implementation enabled. + - Disables and re-enables Gateway API on the existing cluster. + """ + + # reset the count so in replay mode the random names will start with 0 + self.test_resources_count = 0 + + aks_name = self.create_random_name("cliakstest", 16) + self.kwargs.update( + { + "resource_group": resource_group, + "name": aks_name, + "ssh_key_value": self.generate_ssh_keys(), + "location": resource_group_location, + } + ) + + # Create a cluster with Gateway API enabled and no gateway implementation + create_cmd = ( + "aks create --resource-group={resource_group} --name={name} " + "--enable-app-routing " + "--enable-gateway-api " + "--ssh-key-value={ssh_key_value} -o json " + ) + self.cmd( + create_cmd, + checks=[ + self.check("provisioningState", "Succeeded"), + self.check("ingressProfile.gatewayApi.installation", "Standard"), + ], + ) + + # Disable Gateway API + disable_cmd = ( + "aks update --resource-group={resource_group} --name={name} " + "--disable-gateway-api " + ) + self.cmd( + disable_cmd, + checks=[ + self.check("provisioningState", "Succeeded"), + self.check("ingressProfile.gatewayApi.installation", "Disabled"), + ], + ) + + # Re-enable Gateway API + enable_cmd = ( + "aks update --resource-group={resource_group} --name={name} " + "--enable-gateway-api " + ) + self.cmd( + enable_cmd, + checks=[ + self.check("provisioningState", "Succeeded"), + self.check("ingressProfile.gatewayApi.installation", "Standard"), + ], + ) + + # Cleanup + delete_cmd = "aks delete --resource-group={resource_group} --name={name} --yes --no-wait" + self.cmd(delete_cmd, checks=[self.is_empty()]) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py index 4d73ef0e470..26fa24f0167 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py @@ -37,6 +37,8 @@ CONST_MONITORING_USING_AAD_MSI_AUTH, CONST_LOAD_BALANCER_SKU_STANDARD, CONST_LOAD_BALANCER_SKU_BASIC, + CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED, + CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD, CONST_DEFAULT_NODE_OS_TYPE, CONST_VIRTUAL_MACHINE_SCALE_SETS, CONST_NODEPOOL_MODE_SYSTEM, @@ -1867,6 +1869,68 @@ def test_get_nat_gateway_idle_timeout(self): ctx_2.attach_mc(mc) self.assertEqual(ctx_2.get_nat_gateway_idle_timeout(), None) + def test_get_enable_gateway_api(self): + # default value + ctx_1 = AKSManagedClusterContext( + self.cmd, + AKSManagedClusterParamDict({}), + self.models, + decorator_mode=DecoratorMode.CREATE, + ) + gateway_api_1 = ctx_1.get_enable_gateway_api() + self.assertEqual(gateway_api_1, False) + + # custom value + ctx_2 = AKSManagedClusterContext( + self.cmd, + AKSManagedClusterParamDict({"enable_gateway_api": True}), + self.models, + decorator_mode=DecoratorMode.CREATE, + ) + gateway_api_2 = ctx_2.get_enable_gateway_api() + self.assertEqual(gateway_api_2, True) + + # custom value + ctx_3 = AKSManagedClusterContext( + self.cmd, + AKSManagedClusterParamDict({"enable_gateway_api": False}), + self.models, + decorator_mode=DecoratorMode.CREATE, + ) + gateway_api_3 = ctx_3.get_enable_gateway_api() + self.assertEqual(gateway_api_3, False) + + def test_get_disable_gateway_api(self): + # default value + ctx_1 = AKSManagedClusterContext( + self.cmd, + AKSManagedClusterParamDict({}), + self.models, + decorator_mode=DecoratorMode.CREATE, + ) + disable_gateway_api_1 = ctx_1.get_disable_gateway_api() + self.assertEqual(disable_gateway_api_1, False) + + # custom value + ctx_2 = AKSManagedClusterContext( + self.cmd, + AKSManagedClusterParamDict({"disable_gateway_api": True}), + self.models, + decorator_mode=DecoratorMode.UPDATE, + ) + disable_gateway_api_2 = ctx_2.get_disable_gateway_api() + self.assertEqual(disable_gateway_api_2, True) + + # custom value + ctx_3 = AKSManagedClusterContext( + self.cmd, + AKSManagedClusterParamDict({"disable_gateway_api": False}), + self.models, + decorator_mode=DecoratorMode.UPDATE, + ) + disable_gateway_api_3 = ctx_3.get_disable_gateway_api() + self.assertEqual(disable_gateway_api_3, False) + def test_get_outbound_type(self): # default ctx_1 = AKSManagedClusterContext( @@ -12079,6 +12143,140 @@ def test_update_app_routing_profile(self): ) self.assertEqual(dec_mc_9, ground_truth_mc_9) + def test_update_ingress_profile_gateway_api(self): + # Test enabling Gateway API + dec_1 = AKSManagedClusterUpdateDecorator( + self.cmd, + self.client, + {"enable_gateway_api": True}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc_1 = self.models.ManagedCluster(location="test_location") + dec_1.context.attach_mc(mc_1) + dec_mc_1 = dec_1.update_ingress_profile_gateway_api(mc_1) + + ground_truth_ingress_profile_1 = self.models.ManagedClusterIngressProfile( + gateway_api=self.models.ManagedClusterIngressProfileGatewayConfiguration( + installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD + ) + ) + ground_truth_mc_1 = self.models.ManagedCluster( + location="test_location", ingress_profile=ground_truth_ingress_profile_1 + ) + self.assertEqual(dec_mc_1, ground_truth_mc_1) + + # Test with existing ingress profile and web_app_routing enabled + dec_2 = AKSManagedClusterUpdateDecorator( + self.cmd, + self.client, + {"enable_gateway_api": True}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc_2 = self.models.ManagedCluster( + location="test_location", + ingress_profile=self.models.ManagedClusterIngressProfile( + web_app_routing=self.models.ManagedClusterIngressProfileWebAppRouting(enabled=True) + ) + ) + dec_2.context.attach_mc(mc_2) + dec_mc_2 = dec_2.update_ingress_profile_gateway_api(mc_2) + + ground_truth_ingress_profile_2 = self.models.ManagedClusterIngressProfile( + web_app_routing=self.models.ManagedClusterIngressProfileWebAppRouting(enabled=True), + gateway_api=self.models.ManagedClusterIngressProfileGatewayConfiguration( + installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD + ) + ) + ground_truth_mc_2 = self.models.ManagedCluster( + location="test_location", ingress_profile=ground_truth_ingress_profile_2 + ) + self.assertEqual(dec_mc_2, ground_truth_mc_2) + + # Test disable_gateway_api parameter + dec_3 = AKSManagedClusterUpdateDecorator( + self.cmd, + self.client, + {"disable_gateway_api": True}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc_3 = self.models.ManagedCluster( + location="test_location", + ingress_profile=self.models.ManagedClusterIngressProfile( + gateway_api=self.models.ManagedClusterIngressProfileGatewayConfiguration( + installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD + ) + ) + ) + dec_3.context.attach_mc(mc_3) + dec_mc_3 = dec_3.update_ingress_profile_gateway_api(mc_3) + + ground_truth_ingress_profile_3 = self.models.ManagedClusterIngressProfile( + gateway_api=self.models.ManagedClusterIngressProfileGatewayConfiguration( + installation=CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED + ) + ) + ground_truth_mc_3 = self.models.ManagedCluster( + location="test_location", ingress_profile=ground_truth_ingress_profile_3 + ) + self.assertEqual(dec_mc_3, ground_truth_mc_3) + + # Test mutual exclusion - both enable and disable should raise exception + with self.assertRaises(MutuallyExclusiveArgumentError): + dec = AKSManagedClusterUpdateDecorator( + self.cmd, + self.client, + {"enable_gateway_api": True, "disable_gateway_api": True}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc = self.models.ManagedCluster( + location="test_location", + ) + dec.context.attach_mc(mc) + dec_mc = dec.update_ingress_profile_gateway_api(mc) + + # Test without any gateway_api parameters (should not modify anything) + dec_4 = AKSManagedClusterUpdateDecorator( + self.cmd, + self.client, + {}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc_4 = self.models.ManagedCluster(location="test_location") + dec_4.context.attach_mc(mc_4) + dec_mc_4 = dec_4.update_ingress_profile_gateway_api(mc_4) + + ground_truth_mc_4 = self.models.ManagedCluster(location="test_location") + self.assertEqual(dec_mc_4, ground_truth_mc_4) + + # Test without any gateway_api parameters but with existing gateway_api configuration (should not modify) + dec_5 = AKSManagedClusterUpdateDecorator( + self.cmd, + self.client, + {}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc_5 = self.models.ManagedCluster( + location="test_location", + ingress_profile=self.models.ManagedClusterIngressProfile( + gateway_api=self.models.ManagedClusterIngressProfileGatewayConfiguration( + installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD + ) + ) + ) + dec_5.context.attach_mc(mc_5) + dec_mc_5 = dec_5.update_ingress_profile_gateway_api(mc_5) + + # Should remain unchanged + ground_truth_mc_5 = self.models.ManagedCluster( + location="test_location", + ingress_profile=self.models.ManagedClusterIngressProfile( + gateway_api=self.models.ManagedClusterIngressProfileGatewayConfiguration( + installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD + ) + ) + ) + self.assertEqual(dec_mc_5, ground_truth_mc_5) + def test_enable_disable_ai_toolchain_operator(self): # Should not update mc if unset dec_0 = AKSManagedClusterUpdateDecorator( @@ -13512,6 +13710,56 @@ def test_set_up_ingress_web_app_routing(self): ) self.assertEqual(dec_mc_1, ground_truth_mc_1) + def test_set_up_ingress_profile_gateway_api(self): + # Test with enable_gateway_api parameter + dec_1 = AKSManagedClusterCreateDecorator( + self.cmd, + self.client, + {"enable_gateway_api": True}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc_1 = self.models.ManagedCluster(location="test_location") + dec_1.context.attach_mc(mc_1) + dec_mc_1 = dec_1.set_up_ingress_profile_gateway_api(mc_1) + + ground_truth_ingress_profile_1 = self.models.ManagedClusterIngressProfile( + gateway_api=self.models.ManagedClusterIngressProfileGatewayConfiguration( + installation=CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD + ) + ) + ground_truth_mc_1 = self.models.ManagedCluster( + location="test_location", ingress_profile=ground_truth_ingress_profile_1 + ) + self.assertEqual(dec_mc_1, ground_truth_mc_1) + + # Test without enable_gateway_api parameter (should not set gateway_api) + dec_2 = AKSManagedClusterCreateDecorator( + self.cmd, + self.client, + {}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc_2 = self.models.ManagedCluster(location="test_location") + dec_2.context.attach_mc(mc_2) + dec_mc_2 = dec_2.set_up_ingress_profile_gateway_api(mc_2) + + ground_truth_mc_2 = self.models.ManagedCluster(location="test_location") + self.assertEqual(dec_mc_2, ground_truth_mc_2) + + # Test with enable_gateway_api=False (should not set gateway_api) + dec_3 = AKSManagedClusterCreateDecorator( + self.cmd, + self.client, + {"enable_gateway_api": False}, + ResourceType.MGMT_CONTAINERSERVICE, + ) + mc_3 = self.models.ManagedCluster(location="test_location") + dec_3.context.attach_mc(mc_3) + dec_mc_3 = dec_3.set_up_ingress_profile_gateway_api(mc_3) + + ground_truth_mc_3 = self.models.ManagedCluster(location="test_location") + self.assertEqual(dec_mc_3, ground_truth_mc_3) + def test_set_up_app_routing_profile_with_no_nginx(self): dec_1 = AKSManagedClusterCreateDecorator( self.cmd, diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index adc4375e8a8..0d5dc236ebe 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -33,7 +33,7 @@ azure-mgmt-compute==34.1.0 azure-mgmt-containerinstance==10.2.0b1 azure-mgmt-containerregistry==15.1.0b1 azure-mgmt-containerregistrytasks==1.0.0b1 -azure-mgmt-containerservice==41.0.0 +azure-mgmt-containerservice==41.1.0 azure-mgmt-core==1.6.0 azure-mgmt-cosmosdb==9.9.0 azure-mgmt-datalake-nspkg==3.0.1 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index b3b64ad8deb..8d58cb9ebd6 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -33,7 +33,7 @@ azure-mgmt-compute==34.1.0 azure-mgmt-containerinstance==10.2.0b1 azure-mgmt-containerregistry==15.1.0b1 azure-mgmt-containerregistrytasks==1.0.0b1 -azure-mgmt-containerservice==41.0.0 +azure-mgmt-containerservice==41.1.0 azure-mgmt-core==1.6.0 azure-mgmt-cosmosdb==9.9.0 azure-mgmt-datalake-nspkg==3.0.1 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 07895516f36..37c47ad414e 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -33,7 +33,7 @@ azure-mgmt-compute==34.1.0 azure-mgmt-containerinstance==10.2.0b1 azure-mgmt-containerregistry==15.1.0b1 azure-mgmt-containerregistrytasks==1.0.0b1 -azure-mgmt-containerservice==41.0.0 +azure-mgmt-containerservice==41.1.0 azure-mgmt-core==1.6.0 azure-mgmt-cosmosdb==9.9.0 azure-mgmt-datalake-nspkg==3.0.1 diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index 9756c74a0fe..76281312312 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -79,7 +79,7 @@ 'azure-mgmt-containerinstance==10.2.0b1', 'azure-mgmt-containerregistry==15.1.0b1', 'azure-mgmt-containerregistrytasks==1.0.0b1', - 'azure-mgmt-containerservice~=41.0.0', + 'azure-mgmt-containerservice~=41.1.0', 'azure-mgmt-cosmosdb==9.9.0', 'azure-mgmt-datalake-store~=1.1.0b1', 'azure-mgmt-datamigration~=10.0.0',