Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/connectedk8s/azext_connectedk8s/_precheckutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def executing_cluster_diagnostic_checks_job(
kube_config,
kube_context,
helm_client_location,
mcr_url,
)

# Watching for cluster diagnostic checks container to reach in completed stage
Expand Down Expand Up @@ -420,6 +421,7 @@ def helm_install_release_cluster_diagnostic_checks(
kube_config: str | None,
kube_context: str | None,
helm_client_location: str,
mcr_url: str,
onboarding_timeout: str = "60",
) -> None:
cmd_helm_install = [
Expand All @@ -437,6 +439,8 @@ def helm_install_release_cluster_diagnostic_checks(
# To set some other helm parameters through file
cmd_helm_install.extend(["--set", f"global.location={location}"])
cmd_helm_install.extend(["--set", f"global.azureCloud={azure_cloud}"])
cmd_helm_install.extend(["--set", f"global.mcrRepository={mcr_url}"])
cmd_helm_install.extend(["--set", f"global.image.registry={mcr_url}"])
if https_proxy:
cmd_helm_install.extend(["--set", f"global.httpsProxy={https_proxy}"])
if http_proxy:
Expand Down
10 changes: 7 additions & 3 deletions src/connectedk8s/azext_connectedk8s/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ def get_mcr_path(active_directory_endpoint: str) -> str:
mcr_postfix = "com"
# special cases for USSec, exclude part of suffix
if len(active_directory_array) == 4 and active_directory_array[2] == "microsoft":
mcr_postfix = active_directory_array[3]
mcr_postfix = active_directory_array[3].strip("/")
# special case for USNat
elif len(active_directory_array) == 5:
mcr_postfix = (
active_directory_array[2]
+ "."
+ active_directory_array[3]
+ "."
+ active_directory_array[4]
+ active_directory_array[4].strip("/")
)

mcr_url = f"mcr.microsoft.{mcr_postfix}"
Expand Down Expand Up @@ -1865,6 +1865,8 @@ def add_agc_endpoint_overrides(
arm_metadata_endpoint_array[2] + "." + arm_metadata_endpoint_array[3]
)
if cloud_name.lower() == "usnat":
if len(arm_metadata_endpoint_array) < 5:
raise CLIInternalError("Unexpected loginEndpoint format for AGC")
cloud_suffix = (
arm_metadata_endpoint_array[2]
+ "."
Expand All @@ -1883,7 +1885,9 @@ def add_agc_endpoint_overrides(
"--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}",
f"systemDefaultValues.clusterconnect-agent.connect_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",
Expand Down
21 changes: 19 additions & 2 deletions src/connectedk8s/azext_connectedk8s/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,25 @@ def create_connectedk8s(

# Install kubectl and helm
try:
kubectl_client_location = install_kubectl_client()
helm_client_location = install_helm_client(cmd)
# Skip kubectl and helm install for AGC
cloud_name = azure_cloud.lower()
if cloud_name == "ussec" or cloud_name == "usnat":
logger.info(
"Skipping kubectl and helm install for AGC. Expecting them to be pre-installed."
)
kubectl_client_location = shutil.which("kubectl")
helm_client_location = shutil.which("helm")
if not kubectl_client_location:
raise CLIInternalError(
"kubectl not found in PATH for AGC environment. Please install it or add to PATH."
)
if not helm_client_location:
raise CLIInternalError(
"helm not found in PATH for AGC environment. Please install it or add to PATH."
)
else:
kubectl_client_location = install_kubectl_client()
helm_client_location = install_helm_client(cmd)
except Exception as e:
raise CLIInternalError(
f"An exception has occured while trying to perform kubectl or helm install: {e}"
Expand Down
Loading