Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
84b5a39
add pester tests for k8s-extension
Mar 13, 2025
feb18f1
fix testcases for nodepool image issues (#5)
bavneetsingh16 May 23, 2025
c39d105
update readme and version release notes (#6)
bavneetsingh16 May 23, 2025
a9ecd65
fix: simplify logic and enable correct recording rule groups for mana…
bragi92 May 29, 2025
4683050
update readme and version release notes (#6)
bavneetsingh16 May 23, 2025
cb0788d
fix: simplify logic and enable correct recording rule groups for mana…
bragi92 May 29, 2025
bb96daf
Extend ContainerInsights Extension for high log scale mode support (#9)
wanlonghenry Jul 22, 2025
91618ab
update python version to 3.13 (#10)
bavneetsingh16 Jul 31, 2025
f652dac
add pester tests for k8s-extension
Mar 13, 2025
da67e10
fix testcases for nodepool image issues (#5)
bavneetsingh16 May 23, 2025
2f18092
update readme and version release notes (#6)
bavneetsingh16 May 23, 2025
5270054
fix: simplify logic and enable correct recording rule groups for mana…
bragi92 May 29, 2025
7cd1554
update readme and version release notes (#6)
bavneetsingh16 May 23, 2025
68513b4
fix: simplify logic and enable correct recording rule groups for mana…
bragi92 May 29, 2025
605bd21
Extend ContainerInsights Extension for high log scale mode support (#9)
wanlonghenry Jul 22, 2025
e2a51e1
update python version to 3.13 (#10)
bavneetsingh16 Jul 31, 2025
e73f4f4
Merge branch 'main' of https://github.com/AzureArcForKubernetes/k8s-e…
andborja Aug 6, 2025
94bb278
Merge branch 'main' of https://github.com/AzureArcForKubernetes/k8s-e…
andborja Aug 20, 2025
c586523
Add k8s-extension troubleshoot.
andborja Aug 5, 2025
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
9 changes: 6 additions & 3 deletions src/k8s-extension/azext_k8s_extension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

from azure.cli.core import AzCommandsLoader
from . import consts
from typing import Union

from ._help import helps # pylint: disable=unused-import

from knack.commands import CLICommand

class K8sExtensionCommandsLoader(AzCommandsLoader):

Expand All @@ -20,7 +22,7 @@ def __init__(self, cli_ctx=None):
super().__init__(cli_ctx=cli_ctx,
custom_command_type=k8s_extension_custom)

def load_command_table(self, args):
def load_command_table(self, args: Union[list[str], None]) -> dict[str, CLICommand]:
from .commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
Expand All @@ -34,9 +36,10 @@ def load_command_table(self, args):
args=args
)
load_command_table(self, args)
return self.command_table
command_table: dict[str, CLICommand] = self.command_table
return command_table

def load_arguments(self, command):
def load_arguments(self, command: CLICommand):
from ._params import load_arguments
load_arguments(self, command)

Expand Down
12 changes: 12 additions & 0 deletions src/k8s-extension/azext_k8s_extension/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@
--config-protected-file=protected-settings-file
"""

helps[f'{consts.EXTENSION_NAME} troubleshoot'] = f"""
type: command
short-summary: Perform diagnostic checks on a Kubernetes Extension.
long-summary: This command is used to troubleshoot a Kubernetes Extension. It \
collects logs and other information that can be used to diagnose issues with the extension.
examples:
- name: Troubleshoot a Kubernetes Extension
text: |-
az {consts.EXTENSION_NAME} troubleshoot --name extension-name \
--namespace-list "namespace1,namespace2"
"""

helps[f'{consts.EXTENSION_NAME} extension-types'] = """
type: group
short-summary: Commands to discover Kubernetes Extension Types.
Expand Down
20 changes: 19 additions & 1 deletion src/k8s-extension/azext_k8s_extension/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
AddConfigurationProtectedSettings,
)

from knack.commands import CLICommand

def load_arguments(self, _):
def load_arguments(self, _: CLICommand) -> None:
with self.argument_context(consts.EXTENSION_NAME) as c:
c.argument('location',
validator=get_default_location_from_resource_group)
Expand Down Expand Up @@ -131,3 +132,20 @@ def load_arguments(self, _):
c.argument('show_latest',
arg_type=get_three_state_flag(),
help='Filter results by only the latest version. For example, if this flag is used the latest version of the extensionType will be shown.')

with self.argument_context(f"{consts.EXTENSION_NAME} troubleshoot") as c:
c.argument('name',
options_list=['--name', '-n'],
help='Name of the Kubernetes extension')
c.argument('namespace_list',
options_list=['--namespace-list'],
help='Comma-separated list of namespaces to troubleshoot')
c.argument('kube_config',
options_list=['--kube-config'],
help='Path to the kube config file. If not specified, the default kube config file will be used.')
c.argument('kube_context',
options_list=['--kube-context'],
help='Kubeconfig context from current machine. If not specified, the current context from kube config file will be used.')
c.argument('skip_ssl_verification',
action="store_true",
help='Skip SSL verification for any cluster connection.')
1 change: 1 addition & 0 deletions src/k8s-extension/azext_k8s_extension/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def load_command_table(self, _):
g.custom_command('list', 'list_k8s_extension', table_transformer=k8s_extension_list_table_format)
g.custom_show_command('show', 'show_k8s_extension', table_transformer=k8s_extension_show_table_format)
g.custom_command('update', 'update_k8s_extension', supports_no_wait=True)
g.custom_command('troubleshoot', 'troubleshoot_extension', is_preview=True)

# Subgroup - k8s-extension extension-types
k8s_cluster_extension_type_sdk = CliCommandType(
Expand Down
24 changes: 24 additions & 0 deletions src/k8s-extension/azext_k8s_extension/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,27 @@
HYBRIDCONTAINERSERVICE_API_VERSION = "2022-05-01-preview"

EXTENSION_TYPE_API_VERSION = "2023-05-01-preview"

# Fault type constants for error categorization.
# Used to classify different types of faults encountered during diagnostics.
LOAD_KUBECONFIG_FAULT_TYPE = "kubeconfig-load-error" # Error loading kubeconfig file.

# Warning messages for diagnostic failures.
KUBECONFIG_LOAD_FAILED_WARNING = """Unable to load the kubeconfig file.
Please check
https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/diagnose-connection-issues#is-kubeconfig-pointing-to-the-right-cluster"""

EXTRACT_HELMEXE_FAULT_TYPE = "helm-client-extract-error" # Error extracting Helm client executable.

HELM_VERSION = "v3.12.2"

DOWNLOAD_AND_INSTALL_KUBECTL_FAULT_TYPE = "Failed to download and install kubectl" # Error downloading/installing kubectl.

KUBEAPI_CONNECTIVITY_FAILED_WARNING = """Unable to verify connectivity to the Kubernetes cluster.
Please check https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/diagnose-connection-issues"""

KUBERNETES_CONNECTIVITY_FAULT_TYPE = "kubernetes-cluster-connection-error" # Error connecting to Kubernetes cluster.

# Diagnostic log file path constant.
# Used to specify the name of the file where extension diagnostic logs are stored.
ARC_EXT_DIAGNOSTIC_LOGS = "arc_ext_diagnostic_logs"
Loading
Loading