From 5a1df72837e1e89a58f69913df9697abd2a8a8e0 Mon Sep 17 00:00:00 2001 From: Junwei He Date: Mon, 13 Oct 2025 18:11:47 -0400 Subject: [PATCH 1/8] add agc overrides --- src/connectedk8s/azext_connectedk8s/_utils.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/connectedk8s/azext_connectedk8s/_utils.py b/src/connectedk8s/azext_connectedk8s/_utils.py index 6717ed907c1..6700973aa3b 100644 --- a/src/connectedk8s/azext_connectedk8s/_utils.py +++ b/src/connectedk8s/azext_connectedk8s/_utils.py @@ -1360,6 +1360,40 @@ def helm_install_release( "'arcConfigEndpoint' doesn't exist under 'dataplaneEndpoints' in the ARM metadata." ) + # Add overrides for AGC Scenario + if cloud_name.lower() == "ussec" or cloud_name.lower() == "usnat": + logger.debug("Adding AGC scenario overrides.") + + arm_metadata_endpoint_array = arm_metadata["authentication"]["loginEndpoint"].strip("/").split(".") + + if len(arm_metadata_endpoint_array) < 4: + raise CLIInternalError("Unexpected loginEndpoint format for AGC") + + cloud_suffix = arm_metadata_endpoint_array[3] + endpoint_suffix = arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3] + if (cloud_name.lower() == "usnat"): + cloud_suffix = arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3] + "." + arm_metadata_endpoint_array[4] + endpoint_suffix = cloud_suffix + + cmd_helm_install.extend( + [ + "--set", + f"global.microsoftArtifactRepository=mcr.microsoft.{cloud_suffix}", + "--set", + f"systemDefaultValues.activeDirectoryEndpoint=https://login.microsoftonline.{endpoint_suffix}", + "--set", + f"systemDefaultValues.azureArcAgents.config_dp_endpoint_override=https://{location}.dp.kubernetesconfiguration.azure.{endpoint_suffix}", + "--set", + f"systemDefaultValues.clusterconnect-agent.notification_dp_endpoint_override=https://{location}.guestnotificationservice.azure.{endpoint_suffix}", + "--set", + f"systemDefaultValues.clusterconnect-agent.relay_endpoint_suffix_override=.servicebus.cloudapi.{endpoint_suffix}", + "--set", + f"systemDefaultValues.clusteridentityoperator.his_endpoint_override=https://gbl.his.arc.azure.{endpoint_suffix}/discovery?location={location}&api-version=1.1-preview", + "--set", + f"systemDefaultValues.image.repository=mcr.microsoft.{cloud_suffix}", + ] + ) + # Add helmValues content response from DP cmd_helm_install = parse_helm_values(helm_content_values, cmd_helm=cmd_helm_install) From c89d63ee199cc02da5ce24169338f239d125b0c0 Mon Sep 17 00:00:00 2001 From: Junwei He Date: Mon, 20 Oct 2025 14:36:15 -0400 Subject: [PATCH 2/8] update gns endpoint --- src/connectedk8s/azext_connectedk8s/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connectedk8s/azext_connectedk8s/_utils.py b/src/connectedk8s/azext_connectedk8s/_utils.py index 6700973aa3b..73fa58a9430 100644 --- a/src/connectedk8s/azext_connectedk8s/_utils.py +++ b/src/connectedk8s/azext_connectedk8s/_utils.py @@ -1384,7 +1384,7 @@ def helm_install_release( "--set", f"systemDefaultValues.azureArcAgents.config_dp_endpoint_override=https://{location}.dp.kubernetesconfiguration.azure.{endpoint_suffix}", "--set", - f"systemDefaultValues.clusterconnect-agent.notification_dp_endpoint_override=https://{location}.guestnotificationservice.azure.{endpoint_suffix}", + f"systemDefaultValues.clusterconnect-agent.notification_dp_endpoint_override=https://guestnotificationservice.azure.{endpoint_suffix}", "--set", f"systemDefaultValues.clusterconnect-agent.relay_endpoint_suffix_override=.servicebus.cloudapi.{endpoint_suffix}", "--set", From 43eefa0c695560272f893215b316ea38811929a2 Mon Sep 17 00:00:00 2001 From: Junwei He Date: Thu, 23 Oct 2025 08:24:50 -0400 Subject: [PATCH 3/8] add indentation --- src/connectedk8s/azext_connectedk8s/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connectedk8s/azext_connectedk8s/_utils.py b/src/connectedk8s/azext_connectedk8s/_utils.py index 73fa58a9430..166197aa5eb 100644 --- a/src/connectedk8s/azext_connectedk8s/_utils.py +++ b/src/connectedk8s/azext_connectedk8s/_utils.py @@ -1367,7 +1367,7 @@ def helm_install_release( arm_metadata_endpoint_array = arm_metadata["authentication"]["loginEndpoint"].strip("/").split(".") if len(arm_metadata_endpoint_array) < 4: - raise CLIInternalError("Unexpected loginEndpoint format for AGC") + raise CLIInternalError("Unexpected loginEndpoint format for AGC") cloud_suffix = arm_metadata_endpoint_array[3] endpoint_suffix = arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3] From c53d86691d58d59a55f6360af1d7487a09dbf7a2 Mon Sep 17 00:00:00 2001 From: Junwei He Date: Thu, 23 Oct 2025 15:14:52 -0400 Subject: [PATCH 4/8] fix linter error --- src/connectedk8s/azext_connectedk8s/_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/connectedk8s/azext_connectedk8s/_utils.py b/src/connectedk8s/azext_connectedk8s/_utils.py index 166197aa5eb..0ba737a1aa9 100644 --- a/src/connectedk8s/azext_connectedk8s/_utils.py +++ b/src/connectedk8s/azext_connectedk8s/_utils.py @@ -1365,7 +1365,6 @@ def helm_install_release( logger.debug("Adding AGC scenario overrides.") arm_metadata_endpoint_array = arm_metadata["authentication"]["loginEndpoint"].strip("/").split(".") - if len(arm_metadata_endpoint_array) < 4: raise CLIInternalError("Unexpected loginEndpoint format for AGC") From f7498292925547af5c5827d493dfeaa18ef5ffb1 Mon Sep 17 00:00:00 2001 From: Junwei He Date: Thu, 23 Oct 2025 15:55:34 -0400 Subject: [PATCH 5/8] fix ruff formatting --- src/connectedk8s/azext_connectedk8s/_utils.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/connectedk8s/azext_connectedk8s/_utils.py b/src/connectedk8s/azext_connectedk8s/_utils.py index 0ba737a1aa9..3a3decc1967 100644 --- a/src/connectedk8s/azext_connectedk8s/_utils.py +++ b/src/connectedk8s/azext_connectedk8s/_utils.py @@ -1364,14 +1364,24 @@ def helm_install_release( if cloud_name.lower() == "ussec" or cloud_name.lower() == "usnat": logger.debug("Adding AGC scenario overrides.") - arm_metadata_endpoint_array = arm_metadata["authentication"]["loginEndpoint"].strip("/").split(".") + arm_metadata_endpoint_array = ( + arm_metadata["authentication"]["loginEndpoint"].strip("/").split(".") + ) if len(arm_metadata_endpoint_array) < 4: raise CLIInternalError("Unexpected loginEndpoint format for AGC") cloud_suffix = arm_metadata_endpoint_array[3] - endpoint_suffix = arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3] - if (cloud_name.lower() == "usnat"): - cloud_suffix = arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3] + "." + arm_metadata_endpoint_array[4] + endpoint_suffix = ( + arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3] + ) + if cloud_name.lower() == "usnat": + cloud_suffix = ( + arm_metadata_endpoint_array[2] + + "." + + arm_metadata_endpoint_array[3] + + "." + + arm_metadata_endpoint_array[4] + ) endpoint_suffix = cloud_suffix cmd_helm_install.extend( From d0b4cd73d3c17b87351ee4d06cbf41fcdc5792e3 Mon Sep 17 00:00:00 2001 From: Junwei He Date: Fri, 24 Oct 2025 16:11:27 -0400 Subject: [PATCH 6/8] move overrides to it's own method --- src/connectedk8s/azext_connectedk8s/_utils.py | 87 ++++++++++--------- 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/src/connectedk8s/azext_connectedk8s/_utils.py b/src/connectedk8s/azext_connectedk8s/_utils.py index 3a3decc1967..ab1028bc24f 100644 --- a/src/connectedk8s/azext_connectedk8s/_utils.py +++ b/src/connectedk8s/azext_connectedk8s/_utils.py @@ -1311,6 +1311,7 @@ def helm_install_release( ] # Special configurations from 2022-09-01 ARM metadata. + # "dataplaneEndpoints" does not appear in arm_metadata for public and AGC if "dataplaneEndpoints" in arm_metadata: if "arcConfigEndpoint" in arm_metadata["dataplaneEndpoints"]: notification_endpoint = arm_metadata["dataplaneEndpoints"][ @@ -1362,46 +1363,7 @@ def helm_install_release( # Add overrides for AGC Scenario if cloud_name.lower() == "ussec" or cloud_name.lower() == "usnat": - logger.debug("Adding AGC scenario overrides.") - - arm_metadata_endpoint_array = ( - arm_metadata["authentication"]["loginEndpoint"].strip("/").split(".") - ) - if len(arm_metadata_endpoint_array) < 4: - raise CLIInternalError("Unexpected loginEndpoint format for AGC") - - cloud_suffix = arm_metadata_endpoint_array[3] - endpoint_suffix = ( - arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3] - ) - if cloud_name.lower() == "usnat": - cloud_suffix = ( - arm_metadata_endpoint_array[2] - + "." - + arm_metadata_endpoint_array[3] - + "." - + arm_metadata_endpoint_array[4] - ) - endpoint_suffix = cloud_suffix - - cmd_helm_install.extend( - [ - "--set", - f"global.microsoftArtifactRepository=mcr.microsoft.{cloud_suffix}", - "--set", - f"systemDefaultValues.activeDirectoryEndpoint=https://login.microsoftonline.{endpoint_suffix}", - "--set", - f"systemDefaultValues.azureArcAgents.config_dp_endpoint_override=https://{location}.dp.kubernetesconfiguration.azure.{endpoint_suffix}", - "--set", - f"systemDefaultValues.clusterconnect-agent.notification_dp_endpoint_override=https://guestnotificationservice.azure.{endpoint_suffix}", - "--set", - f"systemDefaultValues.clusterconnect-agent.relay_endpoint_suffix_override=.servicebus.cloudapi.{endpoint_suffix}", - "--set", - f"systemDefaultValues.clusteridentityoperator.his_endpoint_override=https://gbl.his.arc.azure.{endpoint_suffix}/discovery?location={location}&api-version=1.1-preview", - "--set", - f"systemDefaultValues.image.repository=mcr.microsoft.{cloud_suffix}", - ] - ) + add_agc_endpoint_overrides(location, cloud_name, arm_metadata, cmd_helm_install) # Add helmValues content response from DP cmd_helm_install = parse_helm_values(helm_content_values, cmd_helm=cmd_helm_install) @@ -1878,3 +1840,48 @@ def helm_update_agent( logger.info(str.format(consts.Update_Agent_Success, cluster_name)) with contextlib.suppress(OSError): os.remove(user_values_location) + + +def add_agc_endpoint_overrides( + location: str, cloud_name: str, arm_metadata: dict[str, Any], cmd_helm: list[str] +) -> None: + logger.debug("Adding AGC scenario overrides.") + + arm_metadata_endpoint_array = ( + arm_metadata["authentication"]["loginEndpoint"].strip("/").split(".") + ) + if len(arm_metadata_endpoint_array) < 4: + raise CLIInternalError("Unexpected loginEndpoint format for AGC") + + cloud_suffix = arm_metadata_endpoint_array[3] + endpoint_suffix = ( + arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3] + ) + if cloud_name.lower() == "usnat": + cloud_suffix = ( + arm_metadata_endpoint_array[2] + + "." + + arm_metadata_endpoint_array[3] + + "." + + arm_metadata_endpoint_array[4] + ) + endpoint_suffix = cloud_suffix + + cmd_helm.extend( + [ + "--set", + f"global.microsoftArtifactRepository=mcr.microsoft.{cloud_suffix}", + "--set", + f"systemDefaultValues.activeDirectoryEndpoint=https://login.microsoftonline.{endpoint_suffix}", + "--set", + f"systemDefaultValues.azureArcAgents.config_dp_endpoint_override=https://{location}.dp.kubernetesconfiguration.azure.{endpoint_suffix}", + "--set", + f"systemDefaultValues.clusterconnect-agent.notification_dp_endpoint_override=https://guestnotificationservice.azure.{endpoint_suffix}", + "--set", + f"systemDefaultValues.clusterconnect-agent.relay_endpoint_suffix_override=.servicebus.cloudapi.{endpoint_suffix}", + "--set", + f"systemDefaultValues.clusteridentityoperator.his_endpoint_override=https://gbl.his.arc.azure.{endpoint_suffix}/discovery?location={location}&api-version=1.1-preview", + "--set", + f"systemDefaultValues.image.repository=mcr.microsoft.{cloud_suffix}", + ] + ) From 6e02cfb39a8cb5f73c0920a67e2e98054e5dde32 Mon Sep 17 00:00:00 2001 From: Junwei He Date: Fri, 24 Oct 2025 16:15:12 -0400 Subject: [PATCH 7/8] update method --- src/connectedk8s/azext_connectedk8s/_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/connectedk8s/azext_connectedk8s/_utils.py b/src/connectedk8s/azext_connectedk8s/_utils.py index ab1028bc24f..87cb14b196b 100644 --- a/src/connectedk8s/azext_connectedk8s/_utils.py +++ b/src/connectedk8s/azext_connectedk8s/_utils.py @@ -1843,7 +1843,7 @@ def helm_update_agent( def add_agc_endpoint_overrides( - location: str, cloud_name: str, arm_metadata: dict[str, Any], cmd_helm: list[str] + location: str, cloud_name: str, arm_metadata: dict[str, Any], cmd_helm_install: list[str] ) -> None: logger.debug("Adding AGC scenario overrides.") @@ -1867,7 +1867,7 @@ def add_agc_endpoint_overrides( ) endpoint_suffix = cloud_suffix - cmd_helm.extend( + cmd_helm_install.extend( [ "--set", f"global.microsoftArtifactRepository=mcr.microsoft.{cloud_suffix}", From 7406877bfbce805ec3f51d406fdaaa556552ed63 Mon Sep 17 00:00:00 2001 From: Junwei He Date: Fri, 24 Oct 2025 16:22:04 -0400 Subject: [PATCH 8/8] update ruff formatting --- src/connectedk8s/azext_connectedk8s/_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/connectedk8s/azext_connectedk8s/_utils.py b/src/connectedk8s/azext_connectedk8s/_utils.py index 87cb14b196b..896ba3b06a7 100644 --- a/src/connectedk8s/azext_connectedk8s/_utils.py +++ b/src/connectedk8s/azext_connectedk8s/_utils.py @@ -1843,7 +1843,10 @@ def helm_update_agent( def add_agc_endpoint_overrides( - location: str, cloud_name: str, arm_metadata: dict[str, Any], cmd_helm_install: list[str] + location: str, + cloud_name: str, + arm_metadata: dict[str, Any], + cmd_helm_install: list[str], ) -> None: logger.debug("Adding AGC scenario overrides.")