Skip to content

Commit 09e51e3

Browse files
authored
az connectedk8s -Release v1.10.8 (#8989)
1 parent b125c9d commit 09e51e3

File tree

10 files changed

+188
-69
lines changed

10 files changed

+188
-69
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
/src/ip-group/ @necusjz @kairu-ms @jsntcy
9090

91-
/src/connectedk8s/ @bavneetsingh16 @deeksha345 @anagg929
91+
/src/connectedk8s/ @bavneetsingh16 @deeksha345 @anagg929 @atchutbarli
9292

9393
/src/storagesync/ @jsntcy
9494

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.8
6+
++++++
7+
* Force delete parameter updated to `connectedk8s delete` command to allow force deletion of connectedk8s ARM resource.
8+
* Parameterize the MCR url for Airgapped clouds.
9+
* Update error strings for config and connectivity errors in connect command.
510

611
1.10.7
712
++++++

src/connectedk8s/azext_connectedk8s/_constants.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@
6363
AHB_Enum_Values = ["True", "False", "NotApplicable"]
6464
Feature_Values = ["cluster-connect", "azure-rbac", "custom-locations"]
6565
CRD_FOR_FORCE_DELETE = [
66-
"arccertificates.clusterconfig.azure.com",
67-
"azureclusteridentityrequests.clusterconfig.azure.com",
68-
"azureextensionidentities.clusterconfig.azure.com",
69-
"connectedclusters.arc.azure.com",
70-
"customlocationsettings.clusterconfig.azure.com",
71-
"extensionconfigs.clusterconfig.azure.com",
72-
"gitconfigs.clusterconfig.azure.com",
66+
"arccertificates.clusterconfig.azure",
67+
"azureclusteridentityrequests.clusterconfig.azure",
68+
"azureextensionidentities.clusterconfig.azure",
69+
"connectedclusters.arc.azure",
70+
"customlocationsettings.clusterconfig.azure",
71+
"extensionconfigs.clusterconfig.azure",
72+
"gitconfigs.clusterconfig.azure",
7373
]
7474
Helm_Install_Release_Userfault_Messages = [
7575
"forbidden",
@@ -418,7 +418,7 @@
418418

419419
# Connect Precheck Diagnoser constants
420420
Cluster_Diagnostic_Checks_Job_Registry_Path = (
421-
"mcr.microsoft.com/azurearck8s/helmchart/stable/clusterdiagnosticchecks:0.2.2"
421+
"azurearck8s/helmchart/stable/clusterdiagnosticchecks:0.2.2"
422422
)
423423
Cluster_Diagnostic_Checks_Helm_Install_Failed_Fault_Type = (
424424
"Error while installing cluster diagnostic checks helm release"
@@ -460,6 +460,14 @@
460460

461461
Custom_Location_Enable_Failed_warning = """Important! Custom Location feature wasn't enabled due to insufficient privileges on the Service Principal Name. If the custom location feature is not enabled, you will encounter an error when creating the custom location. Refer to: https://aka.ms/enable-cl-spn"""
462462

463+
KubeApi_Connectivity_Failed_Warning = """Unable to verify connectivity to the Kubernetes cluster.
464+
Please check https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/diagnose-connection-issues"""
465+
466+
Kubeconfig_Load_Failed_Warning = """Unable to load the kubeconfig file.
467+
Please check https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/diagnose-connection-issues#is-kubeconfig-pointing-to-the-right-cluster"""
468+
469+
Cluster_Already_Onboarded_Error = """The kubernetes cluster is already onboarded.
470+
Please check if the Kubeconfig is pointing to the correct cluster using command: kubectl config current-context."""
463471

464472
# Diagnostic Results Name
465473
Outbound_Connectivity_Check_Result_String = "Outbound Network Connectivity"
@@ -481,8 +489,8 @@
481489
DEFAULT_MAX_ONBOARDING_TIMEOUT_HELMVALUE_SECONDS = "1200"
482490

483491
# URL constants
484-
CLIENT_PROXY_MCR_TARGET = "mcr.microsoft.com/azureconnectivity/proxy"
485-
HELM_MCR_URL = "mcr.microsoft.com/azurearck8s/helm"
492+
CLIENT_PROXY_MCR_TARGET = "azureconnectivity/proxy"
493+
HELM_MCR_URL = "azurearck8s/helm"
486494
HELM_VERSION = "v3.12.2"
487495
Download_And_Install_Kubectl_Fault_Type = "Failed to download and install kubectl"
488496
Azure_Access_Token_Variable = "AZURE_ACCESS_TOKEN"

src/connectedk8s/azext_connectedk8s/_precheckutils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import azext_connectedk8s._utils as azext_utils
2121

2222
if TYPE_CHECKING:
23+
from knack.commands import CLICommand
2324
from kubernetes.client import BatchV1Api, CoreV1Api
2425

2526
logger = get_logger(__name__)
@@ -30,6 +31,7 @@
3031

3132

3233
def fetch_diagnostic_checks_results(
34+
cmd: CLICommand,
3335
corev1_api_instance: CoreV1Api,
3436
batchv1_api_instance: BatchV1Api,
3537
helm_client_location: str,
@@ -52,6 +54,7 @@ def fetch_diagnostic_checks_results(
5254
# Executing the cluster_diagnostic_checks job and fetching the logs obtained
5355
cluster_diagnostic_checks_container_log = (
5456
executing_cluster_diagnostic_checks_job(
57+
cmd,
5558
corev1_api_instance,
5659
batchv1_api_instance,
5760
helm_client_location,
@@ -135,6 +138,7 @@ def fetch_diagnostic_checks_results(
135138

136139

137140
def executing_cluster_diagnostic_checks_job(
141+
cmd: CLICommand,
138142
corev1_api_instance: CoreV1Api,
139143
batchv1_api_instance: BatchV1Api,
140144
helm_client_location: str,
@@ -208,8 +212,10 @@ def executing_cluster_diagnostic_checks_job(
208212
)
209213
return None
210214

215+
mcr_url = azext_utils.get_mcr_path(cmd)
216+
211217
chart_path = azext_utils.get_chart_path(
212-
consts.Cluster_Diagnostic_Checks_Job_Registry_Path,
218+
f"{mcr_url}/{consts.Cluster_Diagnostic_Checks_Job_Registry_Path}",
213219
kube_config,
214220
kube_context,
215221
helm_client_location,

src/connectedk8s/azext_connectedk8s/_utils.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,28 @@
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(".")
63+
64+
# default for public, mc, ff clouds
65+
mcr_postfix = active_directory_array[2]
66+
# special cases for USSec, exclude part of suffix
67+
if len(active_directory_array) == 4 and active_directory_array[2] == "microsoft":
68+
mcr_postfix = active_directory_array[3]
69+
# special case for USNat
70+
elif len(active_directory_array) == 5:
71+
mcr_postfix = (
72+
active_directory_array[2]
73+
+ "."
74+
+ active_directory_array[3]
75+
+ "."
76+
+ active_directory_array[4]
77+
)
78+
79+
mcr_url = f"mcr.microsoft.{mcr_postfix}"
80+
return mcr_url
81+
82+
6183
def validate_connect_rp_location(cmd: CLICommand, location: str) -> None:
6284
subscription_id = (
6385
os.getenv("AZURE_SUBSCRIPTION_ID")
@@ -1332,6 +1354,7 @@ def helm_install_release(
13321354
"Please check if the azure-arc namespace was deployed and run 'kubectl get pods -n azure-arc' "
13331355
"to check if all the pods are in running state. A possible cause for pods stuck in pending "
13341356
"state could be insufficient resources on the kubernetes cluster to onboard to arc."
1357+
" Also pod logs can be checked using kubectl logs <pod-name> -n azure-arc.\n"
13351358
)
13361359
logger.warning(warn_msg)
13371360
raise CLIInternalError(

src/connectedk8s/azext_connectedk8s/clientproxyhelper/_binaryutils.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@
1313
from azure.cli.core import azclierror, telemetry
1414
from azure.cli.core.style import Style, print_styled_text
1515
from knack import log
16+
from knack.commands import CLICommand
1617

1718
import azext_connectedk8s._constants as consts
1819
import azext_connectedk8s._fileutils as file_utils
20+
import azext_connectedk8s._utils as utils
1921

2022
logger = log.get_logger(__name__)
2123

2224

2325
# Downloads client side proxy to connect to Arc Connectivity Platform
2426
def install_client_side_proxy(
25-
arc_proxy_folder: Optional[str], debug: bool = False
27+
cmd: CLICommand, arc_proxy_folder: Optional[str], debug: bool = False
2628
) -> str:
2729
client_operating_system = _get_client_operating_system()
2830
client_architecture = _get_client_architeture()
@@ -48,7 +50,11 @@ def install_client_side_proxy(
4850
)
4951

5052
_download_proxy_from_MCR(
51-
install_dir, proxy_name, client_operating_system, client_architecture
53+
cmd,
54+
install_dir,
55+
proxy_name,
56+
client_operating_system,
57+
client_architecture,
5258
)
5359
_check_proxy_installation(install_dir, proxy_name, debug)
5460

@@ -64,15 +70,21 @@ def install_client_side_proxy(
6470

6571

6672
def _download_proxy_from_MCR(
67-
dest_dir: str, proxy_name: str, operating_system: str, architecture: str
73+
cmd: CLICommand,
74+
dest_dir: str,
75+
proxy_name: str,
76+
operating_system: str,
77+
architecture: str,
6878
) -> None:
69-
mar_target = f"{consts.CLIENT_PROXY_MCR_TARGET}/{operating_system.lower()}/{architecture}/arc-proxy"
79+
mcr_url = utils.get_mcr_path(cmd)
80+
81+
mar_target = f"{mcr_url}/{consts.CLIENT_PROXY_MCR_TARGET}/{operating_system.lower()}/{architecture}/arc-proxy"
7082
logger.debug(
7183
"Downloading Arc Connectivity Proxy from %s in Microsoft Artifact Regristy.",
7284
mar_target,
7385
)
7486

75-
client = oras.client.OrasClient()
87+
client = oras.client.OrasClient(hostname=mcr_url)
7688
t0 = time.time()
7789

7890
try:

src/connectedk8s/azext_connectedk8s/clientproxyhelper/_proxylogic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
if TYPE_CHECKING:
1919
from subprocess import Popen
2020

21-
from knack.commands import CLICommmand
21+
from knack.commands import CLICommand
2222
from requests.models import Response
2323

2424
from azext_connectedk8s.vendored_sdks.preview_2024_07_01.models import (
@@ -30,7 +30,7 @@
3030

3131

3232
def handle_post_at_to_csp(
33-
cmd: CLICommmand,
33+
cmd: CLICommand,
3434
api_server_port: int,
3535
tenant_id: str,
3636
clientproxy_process: Popen[bytes],

0 commit comments

Comments
 (0)