Skip to content

Commit 4253515

Browse files
bavneetsingh16Bavneet Singhatchutbarlivineeth-thummamcnealm13
authored
[connectedk8s] Update extension CLI to v1.10.11 (Azure#9304)
* add pester tests for connectedk8s cli extension * Pass the force delete param to the API call (#4) * forcedelete * format * add code owner * mypy * fix CI testcases for nodepool image issues (#8) * update python version to 3.13 (Azure#12) * changes to support gateway association/disassociation for api version '2025-08-01-preview' (Azure#17) * [Azure RBAC] Deprecate 3P mode flags, fix Azure RBAC enablement bug, add E2E coverage and improve logging (Azure#20) * add pester tests for connectedk8s cli extension * Pass the force delete param to the API call (#4) * forcedelete * format * add code owner * mypy * Parameterize for airgapped clouds (#5) * Add parameterization for the airgapped clouds * Fix azdev style * MCR path function * azdev, ruff, and mypy --------- Co-authored-by: Matthew McNeal (from Dev Box) <mmcneal@microsoft.com> * Oras client fix to work with different MCRs (#6) Co-authored-by: mmcneal <mmcneal@microsoft.com> * fix CI testcases for nodepool image issues (#8) * update errors for the config and connectivity issues (Azure#11) * update errors * format * style * update python version to 3.13 (Azure#12) * Update cluster diagnostics image to 1.29.3 (#7) * Update cluster diagnostics helm chart to 1.29.3 * Fix lint issues --------- Co-authored-by: bgriddaluru <bharath.griddaluru@microsoft.com> * RBAC deprecation & fix the issue * typo * fix comments * update tests * add pester tests for connectedk8s cli extension * Pass the force delete param to the API call (#4) * forcedelete * format * add code owner * mypy * fix CI testcases for nodepool image issues (#8) * update errors for the config and connectivity issues (Azure#11) * update errors * format * style * update python version to 3.13 (Azure#12) * rebase * fix tests * fix version * fix mypy, lint * fix test * fix test * fix test * fix test * fix test * rename test * deprecate flags * rebase * rebase * bump version for release --------- Co-authored-by: Bavneet Singh <bavneetsingh@microsoft.com> Co-authored-by: Atchut Kumar Barli <atchut@gmail.com> Co-authored-by: mcnealm13 <57726243+mcnealm13@users.noreply.github.com> Co-authored-by: Matthew McNeal (from Dev Box) <mmcneal@microsoft.com> Co-authored-by: Bavneet Singh <33008256+bavneetsingh16@users.noreply.github.com> Co-authored-by: bgriddaluru <117554445+bgriddaluru@users.noreply.github.com> Co-authored-by: bgriddaluru <bharath.griddaluru@microsoft.com> Co-authored-by: vithumma <vithumma@microsoft.com> * remove hardcoded public ARM endpoint url for fairfax and mooncake (Azure#24) * Bug Fix for FFX mcr url (Azure#22) * [connectedk8s] update release notes and version (Azure#26) * remove redundant test files * remove change not relevant to connectedk8s release --------- Co-authored-by: Bavneet Singh <bavneetsingh@microsoft.com> Co-authored-by: Atchut Kumar Barli <atchut@gmail.com> Co-authored-by: Vineeth Thumma <vineeth-thumma@users.noreply.github.com> Co-authored-by: mcnealm13 <57726243+mcnealm13@users.noreply.github.com> Co-authored-by: Matthew McNeal (from Dev Box) <mmcneal@microsoft.com> Co-authored-by: bgriddaluru <117554445+bgriddaluru@users.noreply.github.com> Co-authored-by: bgriddaluru <bharath.griddaluru@microsoft.com> Co-authored-by: vithumma <vithumma@microsoft.com> Co-authored-by: hapate <hapate@microsoft.com>
1 parent c6adfa1 commit 4253515

File tree

8 files changed

+40
-10
lines changed

8 files changed

+40
-10
lines changed

src/connectedk8s/HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
33
Release History
44
===============
5+
1.10.11
6+
+++++++
7+
* Removed hardcoded public ARM endpoint URL for Government clouds.
8+
* Fixed incorrect MCR endpoint URLs for Government cloud environments.
9+
510
1.10.10
611
+++++
712
* Deprecated '--app-id' and '--app-secret' RBAC parameters from the extension by adding them to _breaking_change.py.

src/connectedk8s/azext_connectedk8s/_client_factory.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ def cf_connectedk8s_prev_2025_08_01(
8383
KubernetesClient,
8484
subscription_id=os.getenv("AZURE_SUBSCRIPTION_ID"),
8585
credential=credential,
86-
base_url="https://management.azure.com",
8786
per_call_policies=[headers_policy],
8887
)
8988
return client
9089

9190
client = get_mgmt_service_client(
9291
cli_ctx,
9392
KubernetesClient,
94-
base_url="https://management.azure.com",
9593
per_call_policies=[headers_policy],
9694
)
9795
return client

src/connectedk8s/azext_connectedk8s/_precheckutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def executing_cluster_diagnostic_checks_job(
212212
)
213213
return None
214214

215-
mcr_url = azext_utils.get_mcr_path(cmd)
215+
mcr_url = azext_utils.get_mcr_path(cmd.cli_ctx.cloud.endpoints.active_directory)
216216

217217
chart_path = azext_utils.get_chart_path(
218218
f"{mcr_url}/{consts.Cluster_Diagnostic_Checks_Job_Registry_Path}",

src/connectedk8s/azext_connectedk8s/_utils.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@
5858
# pylint: disable=bare-except
5959

6060

61-
def get_mcr_path(cmd: CLICommand) -> str:
62-
active_directory_array = cmd.cli_ctx.cloud.endpoints.active_directory.split(".")
61+
def get_mcr_path(active_directory_endpoint: str) -> str:
62+
active_directory_array = active_directory_endpoint.split(".")
6363

64-
# default for public, mc, ff clouds
65-
mcr_postfix = active_directory_array[2]
64+
# For US Government and China clouds, use public mcr
65+
if active_directory_endpoint.endswith((".us", ".cn")):
66+
return "mcr.microsoft.com"
67+
68+
# Default MCR postfix
69+
mcr_postfix = "com"
6670
# special cases for USSec, exclude part of suffix
6771
if len(active_directory_array) == 4 and active_directory_array[2] == "microsoft":
6872
mcr_postfix = active_directory_array[3]

src/connectedk8s/azext_connectedk8s/clientproxyhelper/_binaryutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _download_proxy_from_MCR(
7676
operating_system: str,
7777
architecture: str,
7878
) -> None:
79-
mcr_url = utils.get_mcr_path(cmd)
79+
mcr_url = utils.get_mcr_path(cmd.cli_ctx.cloud.endpoints.active_directory)
8080

8181
mar_target = f"{mcr_url}/{consts.CLIENT_PROXY_MCR_TARGET}/{operating_system.lower()}/{architecture}/arc-proxy"
8282
logger.debug(

src/connectedk8s/azext_connectedk8s/custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ def install_helm_client(cmd: CLICommand) -> str:
13181318
"Downloading helm client for first time. This can take few minutes..."
13191319
)
13201320

1321-
mcr_url = utils.get_mcr_path(cmd)
1321+
mcr_url = utils.get_mcr_path(cmd.cli_ctx.cloud.endpoints.active_directory)
13221322

13231323
client = oras.client.OrasClient(hostname=mcr_url)
13241324
retry_count = 3

src/connectedk8s/azext_connectedk8s/tests/unittests/test_utils_.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")))
1111
from azext_connectedk8s._utils import (
12+
get_mcr_path,
1213
process_helm_error_detail,
1314
redact_sensitive_fields_from_string,
1415
remove_rsa_private_key,
@@ -76,5 +77,27 @@ def test_redact_sensitive_fields_from_string():
7677
)
7778

7879

80+
def test_get_mcr_path():
81+
input_active_directory = "login.microsoftonline.com"
82+
expected_output = "mcr.microsoft.com"
83+
assert get_mcr_path(input_active_directory) == expected_output
84+
85+
input_active_directory = "login.microsoftonline.us"
86+
expected_output = "mcr.microsoft.com"
87+
assert get_mcr_path(input_active_directory) == expected_output
88+
89+
input_active_directory = "login.chinacloudapi.cn"
90+
expected_output = "mcr.microsoft.com"
91+
assert get_mcr_path(input_active_directory) == expected_output
92+
93+
input_active_directory = "https://login.microsoftonline.microsoft.foo"
94+
expected_output = "mcr.microsoft.foo"
95+
assert get_mcr_path(input_active_directory) == expected_output
96+
97+
input_active_directory = "https://login.microsoftonline.some.cloud.bar"
98+
expected_output = "mcr.microsoft.some.cloud.bar"
99+
assert get_mcr_path(input_active_directory) == expected_output
100+
101+
79102
if __name__ == "__main__":
80103
pytest.main()

src/connectedk8s/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# TODO: Confirm this is the right version number you want and it matches your
1414
# HISTORY.rst entry.
1515

16-
VERSION = "1.10.10"
16+
VERSION = "1.10.11"
1717

1818
# The full list of classifiers is available at
1919
# https://pypi.python.org/pypi?%3Aaction=list_classifiers

0 commit comments

Comments
 (0)