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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

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

/src/connectedk8s/ @bavneetsingh16 @deeksha345 @anagg929
/src/connectedk8s/ @bavneetsingh16 @deeksha345 @anagg929 @atchutbarli

/src/storagesync/ @jsntcy

Expand Down
5 changes: 5 additions & 0 deletions src/connectedk8s/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

1.10.8
++++++
* Add checks for the bundling feature flag in the 'connectedk8s connect' and 'connectedk8s update' commands.
* Display a more detailed error message when the 'connectedk8s upgrade' command fails with the bundling feature enabled.

1.10.7
++++++
* Added support for discovering additional k8s distributions and Infrastructure.
Expand Down
39 changes: 29 additions & 10 deletions src/connectedk8s/azext_connectedk8s/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@
AHB_Enum_Values = ["True", "False", "NotApplicable"]
Feature_Values = ["cluster-connect", "azure-rbac", "custom-locations"]
CRD_FOR_FORCE_DELETE = [
"arccertificates.clusterconfig.azure.com",
"azureclusteridentityrequests.clusterconfig.azure.com",
"azureextensionidentities.clusterconfig.azure.com",
"connectedclusters.arc.azure.com",
"customlocationsettings.clusterconfig.azure.com",
"extensionconfigs.clusterconfig.azure.com",
"gitconfigs.clusterconfig.azure.com",
"arccertificates.clusterconfig.azure",
"azureclusteridentityrequests.clusterconfig.azure",
"azureextensionidentities.clusterconfig.azure",
"connectedclusters.arc.azure",
"customlocationsettings.clusterconfig.azure",
"extensionconfigs.clusterconfig.azure",
"gitconfigs.clusterconfig.azure",
]
Helm_Install_Release_Userfault_Messages = [
"forbidden",
Expand Down Expand Up @@ -134,6 +134,8 @@
Get_HelmRegistery_Path_Fault_Type = "helm-registry-path-fetch-error"
Pull_HelmChart_Fault_Type = "helm-chart-pull-error"
Export_HelmChart_Fault_Type = "helm-chart-export-error"
List_Extension_Config_Fault_Type = "kubernetes-list-extension-config-error"
List_Kubernetes_Namespaced_Pod_Fault_Type = "kubernetes-list-namespaced-pod-error"
Get_Kubernetes_Distro_Fault_Type = "kubernetes-get-distribution-error"
Get_Kubernetes_Namespace_Fault_Type = "kubernetes-get-namespace-error"
Get_Kubernetes_Helm_Release_Namespace_Fault_Type = (
Expand Down Expand Up @@ -418,7 +420,7 @@

# Connect Precheck Diagnoser constants
Cluster_Diagnostic_Checks_Job_Registry_Path = (
"mcr.microsoft.com/azurearck8s/helmchart/stable/clusterdiagnosticchecks:0.2.2"
"azurearck8s/helmchart/stable/clusterdiagnosticchecks:0.2.2"
)
Cluster_Diagnostic_Checks_Helm_Install_Failed_Fault_Type = (
"Error while installing cluster diagnostic checks helm release"
Expand Down Expand Up @@ -481,8 +483,8 @@
DEFAULT_MAX_ONBOARDING_TIMEOUT_HELMVALUE_SECONDS = "1200"

# URL constants
CLIENT_PROXY_MCR_TARGET = "mcr.microsoft.com/azureconnectivity/proxy"
HELM_MCR_URL = "mcr.microsoft.com/azurearck8s/helm"
CLIENT_PROXY_MCR_TARGET = "azureconnectivity/proxy"
HELM_MCR_URL = "azurearck8s/helm"
HELM_VERSION = "v3.12.2"
Download_And_Install_Kubectl_Fault_Type = "Failed to download and install kubectl"
Azure_Access_Token_Variable = "AZURE_ACCESS_TOKEN"
Expand Down Expand Up @@ -517,3 +519,20 @@
# "Application code shouldn't block the creation of resources for a resource provider that is in the registering state."
# See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types#register-resource-provider
allowed_rp_registration_states = ["Registering", "Registered"]

Connected_Cluster_Type = "connectedClusters"
Arc_Agent_Update_Validator_Job_Label = "agent-update-validator"

Arc_Agentry_Bundle_Feature = "extensionSets"
Arc_Agentry_Bundle_Feature_Setting = "versionManagedExtensions"

Bundle_Feature_Value_List = ["enabled", "disabled", "preview"]

Extension_Config_CRD_Group = "clusterconfig.azure.com"
Extension_Config_CRD_Version = "v1beta1"
Extension_Config_CRD_Plural = "extensionconfigs"

Get_Bundle_Feature_Flag_Fault_Type = "get-bundle-feature-flag-error"
Get_Extension_Config_Bundle_Property_Fault_Type = (
"get-extension-config-bundle-property-error"
)
8 changes: 7 additions & 1 deletion src/connectedk8s/azext_connectedk8s/_precheckutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import azext_connectedk8s._utils as azext_utils

if TYPE_CHECKING:
from knack.commands import CLICommand
from kubernetes.client import BatchV1Api, CoreV1Api

logger = get_logger(__name__)
Expand All @@ -30,6 +31,7 @@


def fetch_diagnostic_checks_results(
cmd: CLICommand,
corev1_api_instance: CoreV1Api,
batchv1_api_instance: BatchV1Api,
helm_client_location: str,
Expand All @@ -52,6 +54,7 @@ def fetch_diagnostic_checks_results(
# Executing the cluster_diagnostic_checks job and fetching the logs obtained
cluster_diagnostic_checks_container_log = (
executing_cluster_diagnostic_checks_job(
cmd,
corev1_api_instance,
batchv1_api_instance,
helm_client_location,
Expand Down Expand Up @@ -135,6 +138,7 @@ def fetch_diagnostic_checks_results(


def executing_cluster_diagnostic_checks_job(
cmd: CLICommand,
corev1_api_instance: CoreV1Api,
batchv1_api_instance: BatchV1Api,
helm_client_location: str,
Expand Down Expand Up @@ -208,8 +212,10 @@ def executing_cluster_diagnostic_checks_job(
)
return None

mcr_url = azext_utils.get_mcr_path(cmd)

chart_path = azext_utils.get_chart_path(
consts.Cluster_Diagnostic_Checks_Job_Registry_Path,
f"{mcr_url}/{consts.Cluster_Diagnostic_Checks_Job_Registry_Path}",
kube_config,
kube_context,
helm_client_location,
Expand Down
22 changes: 22 additions & 0 deletions src/connectedk8s/azext_connectedk8s/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,28 @@
# pylint: disable=bare-except


def get_mcr_path(cmd: CLICommand) -> str:
active_directory_array = cmd.cli_ctx.cloud.endpoints.active_directory.split(".")

# default for public, mc, ff clouds
mcr_postfix = active_directory_array[2]
# 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]
# special case for USNat
elif len(active_directory_array) == 5:
mcr_postfix = (
active_directory_array[2]
+ "."
+ active_directory_array[3]
+ "."
+ active_directory_array[4]
)

mcr_url = f"mcr.microsoft.{mcr_postfix}"
return mcr_url


def validate_connect_rp_location(cmd: CLICommand, location: str) -> None:
subscription_id = (
os.getenv("AZURE_SUBSCRIPTION_ID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@
from azure.cli.core import azclierror, telemetry
from azure.cli.core.style import Style, print_styled_text
from knack import log
from knack.commands import CLICommand

import azext_connectedk8s._constants as consts
import azext_connectedk8s._fileutils as file_utils
import azext_connectedk8s._utils as utils

logger = log.get_logger(__name__)


# Downloads client side proxy to connect to Arc Connectivity Platform
def install_client_side_proxy(
arc_proxy_folder: Optional[str], debug: bool = False
cmd: CLICommand, arc_proxy_folder: Optional[str], debug: bool = False
) -> str:
client_operating_system = _get_client_operating_system()
client_architecture = _get_client_architeture()
Expand All @@ -48,7 +50,11 @@ def install_client_side_proxy(
)

_download_proxy_from_MCR(
install_dir, proxy_name, client_operating_system, client_architecture
cmd,
install_dir,
proxy_name,
client_operating_system,
client_architecture,
)
_check_proxy_installation(install_dir, proxy_name, debug)

Expand All @@ -64,15 +70,21 @@ def install_client_side_proxy(


def _download_proxy_from_MCR(
dest_dir: str, proxy_name: str, operating_system: str, architecture: str
cmd: CLICommand,
dest_dir: str,
proxy_name: str,
operating_system: str,
architecture: str,
) -> None:
mar_target = f"{consts.CLIENT_PROXY_MCR_TARGET}/{operating_system.lower()}/{architecture}/arc-proxy"
mcr_url = utils.get_mcr_path(cmd)

mar_target = f"{mcr_url}/{consts.CLIENT_PROXY_MCR_TARGET}/{operating_system.lower()}/{architecture}/arc-proxy"
logger.debug(
"Downloading Arc Connectivity Proxy from %s in Microsoft Artifact Regristy.",
mar_target,
)

client = oras.client.OrasClient()
client = oras.client.OrasClient(hostname=mcr_url)
t0 = time.time()

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
if TYPE_CHECKING:
from subprocess import Popen

from knack.commands import CLICommmand
from knack.commands import CLICommand
from requests.models import Response

from azext_connectedk8s.vendored_sdks.preview_2024_07_01.models import (
Expand All @@ -30,7 +30,7 @@


def handle_post_at_to_csp(
cmd: CLICommmand,
cmd: CLICommand,
api_server_port: int,
tenant_id: str,
clientproxy_process: Popen[bytes],
Expand Down
Loading
Loading