Skip to content

New version of k8s-extension CLI (v1.8.0) using API version 2025-03-01#10045

Open
prasannajsns wants to merge 36 commits into
Azure:mainfrom
AzureArcForKubernetes:release-v1.8.0
Open

New version of k8s-extension CLI (v1.8.0) using API version 2025-03-01#10045
prasannajsns wants to merge 36 commits into
Azure:mainfrom
AzureArcForKubernetes:release-v1.8.0

Conversation

@prasannajsns

Copy link
Copy Markdown
Member

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (azdev required; see .azure-pipelines/templates/azdev_setup.yml for the install command until azdev==0.2.11b1 is on PyPI)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Bavneet Singh and others added 30 commits September 3, 2025 13:33
…0250301

Add API version 2025-03-01 for extension resource operations
…0250301

Fix ModuleNotFound errors in clientconfiguration tests
tomaandreisacuiu and others added 5 commits June 12, 2026 12:53
…nodes-ext-cli-customization

Add CLI customization for the microsoft.virtualnodes partner extension type for AKS
Fix validations for version and auto-upgrade-mode combinations and im…
Copilot AI review requested due to automatic review settings June 26, 2026 08:09
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @prasannajsns,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the k8s-extension Azure CLI extension to v1.8.0, including migrating the underlying Extensions API version to 2025-03-01 via newly vendored SDKs and adding new end-user functionality (notably az k8s-extension troubleshoot) plus partner-extension updates.

Changes:

  • Bump extension version to 1.8.0, update release history, and add runtime dependencies (kubernetes client, oras, azure-mgmt-network).
  • Vendor a new v2025_03_01 SDK profile and wire it into the multi-api client selection and tests/recordings.
  • Add az k8s-extension troubleshoot command and supporting diagnostics collection utilities; extend partner extensions (e.g., VirtualNodes) and add auto_upgrade_mode support in partner extension models.

Reviewed changes

Copilot reviewed 55 out of 55 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/k8s-extension/setup.py Adds dependencies and bumps extension version to 1.8.0.
src/k8s-extension/HISTORY.rst Adds 1.8.0 release notes (API version migration).
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/py.typed Marks vendored SDK package as typed (PEP 561).
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/operations/_patch.py Generated customization hook for sync operations.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/operations/init.py Exposes generated sync operations and patch hook.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/models/_patch.py Generated customization hook for models.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/models/_models.py Adds generated models for 2025-03-01 profile.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/models/_enums.py Adds generated enums for 2025-03-01 profile.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/models/init.py Exports generated models/enums and patch hook.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/aio/operations/_patch.py Generated customization hook for async operations.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/aio/operations/_operations.py Adds generated async operations for 2025-03-01 profile.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/aio/operations/init.py Exposes generated async operations and patch hook.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/aio/_patch.py Generated customization hook for async client package.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/aio/_configuration.py Adds generated async client configuration for 2025-03-01.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/aio/_client.py Adds generated async client for 2025-03-01.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/aio/init.py Exports async client for 2025-03-01.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/_version.py Adds generated version marker for vendored SDK package.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/_utils/model_base.py Adds generated model/serialization infrastructure.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/_utils/init.py Adds generated utils package init.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/_patch.py Generated customization hook for sync client package.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/_configuration.py Adds generated sync client configuration for 2025-03-01.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/_client.py Adds generated sync client for 2025-03-01.
src/k8s-extension/azext_k8s_extension/vendored_sdks/v2025_03_01/init.py Exports sync client/version for 2025-03-01.
src/k8s-extension/azext_k8s_extension/vendored_sdks/models.py Re-exports models for the new 2025-03-01 profile.
src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_source_control_configuration_client.py Adds 2025-03-01 profile wiring + base_url propagation in async client.
src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_configuration.py Adds base_url/api_version/polling_interval to async configuration.
src/k8s-extension/azext_k8s_extension/vendored_sdks/_source_control_configuration_client.py Adds 2025-03-01 profile wiring + base_url propagation in sync client.
src/k8s-extension/azext_k8s_extension/vendored_sdks/_configuration.py Adds base_url/api_version/polling_interval to sync configuration.
src/k8s-extension/azext_k8s_extension/utils.py Adds diagnostics collection helpers and Kubernetes error handling.
src/k8s-extension/azext_k8s_extension/tests/latest/test_client_configuration.py Adds unit tests for base_url propagation in vendored clients/configs.
src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension.yaml Updates recordings to use api-version=2025-03-01.
src/k8s-extension/azext_k8s_extension/partner_extensions/VirtualNodes.py Adds VirtualNodes partner extension with AKS/VNET validation and subnet delegation.
src/k8s-extension/azext_k8s_extension/partner_extensions/PartnerExtensionModel.py Extends partner extension interface to include auto_upgrade_mode.
src/k8s-extension/azext_k8s_extension/partner_extensions/OpenServiceMesh.py Passes through auto_upgrade_mode in partner extension create flow.
src/k8s-extension/azext_k8s_extension/partner_extensions/DefaultExtension.py Adds auto_upgrade_mode propagation for default partner extension behaviors.
src/k8s-extension/azext_k8s_extension/partner_extensions/DataProtectionKubernetes.py Adds auto_upgrade_mode propagation for the extension.
src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py Adds auto_upgrade_mode propagation for create/update.
src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py Adds auto_upgrade_mode propagation for create.
src/k8s-extension/azext_k8s_extension/partner_extensions/azuremonitormetrics/dc/defaults.py Refactors default naming helpers for DCR/DCE/DCRA.
src/k8s-extension/azext_k8s_extension/partner_extensions/azuremonitormetrics/dc/dcra_api.py Updates DCRA naming to new helper signature.
src/k8s-extension/azext_k8s_extension/partner_extensions/azuremonitormetrics/dc/dcr_api.py Uses new DCR naming helper.
src/k8s-extension/azext_k8s_extension/partner_extensions/azuremonitormetrics/dc/dce_api.py Uses new DCE naming helper.
src/k8s-extension/azext_k8s_extension/partner_extensions/azuremonitormetrics/amw/defaults.py Changes RP locations query to be subscription-scoped; updates default region helpers.
src/k8s-extension/azext_k8s_extension/partner_extensions/azuremonitormetrics/amw/create.py Passes subscription to AMW default-name/region helper.
src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMonitorMetrics.py Adds auto_upgrade_mode propagation.
src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py Adds auto_upgrade_mode propagation in create/update.
src/k8s-extension/azext_k8s_extension/partner_extensions/AzureDefender.py Adds auto_upgrade_mode propagation in create.
src/k8s-extension/azext_k8s_extension/custom.py Adds troubleshoot command implementation, Helm/kubectl acquisition, and auto_upgrade_mode validation.
src/k8s-extension/azext_k8s_extension/consts.py Adds troubleshoot-related constants and diagnostic strings.
src/k8s-extension/azext_k8s_extension/commands.py Registers the new troubleshoot command.
src/k8s-extension/azext_k8s_extension/_params.py Adds CLI parameters for --auto-upgrade-mode and the troubleshoot command.
src/k8s-extension/azext_k8s_extension/_help.py Adds help text/examples for az k8s-extension troubleshoot.
src/k8s-extension/azext_k8s_extension/init.py Adds/adjusts type hints in command loader.

Comment on lines +39 to +43
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.
Comment on lines +311 to +318
try:
# Fetching path to user directory to create the arc diagnostic folder
home_dir = os.path.expanduser("~")
filepath = os.path.join(home_dir, ".azure", base_folder_name)
# Creating Diagnostic folder and its subfolder with the given timestamp and cluster name to store all the logs
with contextlib.suppress(FileExistsError):
os.mkdir(filepath)
filepath_with_timestamp = os.path.join(filepath, folder_name)
Comment on lines +587 to +595
print("Collecting diagnostics information from the namespaces provided. This operation may take a while to complete ...\n")

namespaces = [ns.strip() for ns in namespace_list.split(',') if ns.strip()]

# Check if namespaces list is empty and throw an exception
if not namespaces:
raise RequiredArgumentMissingError(
"No valid namespaces provided. Please provide at least one namespace."
)
Comment on lines +619 to +628
# Generate the diagnostic folder in a given location
filepath_with_timestamp, diagnostic_folder_status = (
utils.create_folder_diagnosticlogs(
diagnostic_logs_folder_name, consts.ARC_EXT_DIAGNOSTIC_LOGS
)
)

if diagnostic_folder_status is not True:
storage_space_available = False

Comment on lines +661 to +668
folder_namespace, folder_namespace_status = (
utils.create_folder_diagnostics_namespace(base_path, namespace)
)

if folder_namespace_status is not True:
logger.error(f"Failed to create diagnostics folder for namespace '{namespace}'.")
collection_success = False

Comment on lines +245 to +248
container_log = api_instance.read_namespaced_pod_log(
name=pod_name, container=container_name, namespace=namespace
)

Comment on lines +223 to +229
if pod.spec is not None:
if pod.spec.init_containers is not None:
for init_container in pod.spec.init_containers:
init_container_logs_status = collect_container_logs(api_instance, containers_folder_name, namespace, pod_name, init_container)
if not init_container_logs_status:
logger.error(f"Failed to collect logs from init container '{init_container.name}' in pod '{pod_name}'")
if pod.spec.containers is not None:
Comment on lines +260 to +262
def convert_to_pod_dict(pod) -> dict:
if pod.metadata is None or pod.status is None:
return None
Comment on lines +5 to 6
from ..constants import DC_TYPE
from ..deaults import get_default_region
Comment on lines +142 to +147
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')
@yonzhan

yonzhan commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

k8s-extension

@prasannajsns prasannajsns changed the title Update k8s-extension CLI to v1.8.0 New version of k8s-extension CLI (v1.8.0) using API version 2025-03-01 Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.