connectedk8s: release v1.11.2 - #10236
Conversation
* Adding CLI changes for AGC Scenario * Adding CLI changes for AGC Scenario * remove special case for base_path, false scenario * Refactor CLI tool locations * Address mypy error * Ruff formatting
…o Agent conversion in connected clusters (#46) * [az-cli][connectedk8s][MultiCloudConnector] Allow AgentNotInstalled to Agent conversion in connected clusters
* propagate correlation-id to arc proxy * code clean up * add version infirmation * add doc * nit: fix logger statement * style check - code cleanup * remove redundant import * code clean up.
…nstrumentation, and catch-all decorato (#53) * adding telemetry updates to update unknown * Fix telemetry reporting: wrap string exceptions in Exception() and add catch-all decorator - Replace all exception='string' calls with exception=Exception('string') across custom.py, _utils.py, and _precheckutils.py so that ExceptionName in telemetry shows 'Exception' instead of 'str' - Add _telemetry_catch_all decorator to top-level command functions (create, delete, update, upgrade) to catch unhandled exceptions, log them to telemetry with proper ExceptionName/FaultType, and re-raise as CLIInternalError instead of letting them become 'UnknownError' * Fix mypy and ruff: add type annotations to _telemetry_catch_all decorator and fix import sorting * Apply ruff format to fix CI format check * Remove accidentally committed files
* fix(connectedk8s): make azdev style pass with targeted formatting and justified suppressions * fix(connectedk8s): narrow broad exception suppressions where low risk * Add rationale comments for style suppressions * Add rationale comments for exception handling in clientproxy helper * fix: ruff format clientproxyhelper/_utils.py * narrow broad-exception-caught to specific types in _precheckutils.py and _utils.py - _precheckutils.py: narrow 3 of 5 catches (KeyError/AttributeError/TypeError for watch loop, ValueError/TypeError for file writes after OSError handler) - _utils.py: remove module-level pylint disable, narrow 8 catches to specific types (ValueError/TypeError for file I/O, ValueError/KeyError for JSON parsing, TypeError/AttributeError/RecursionError for dict flattening, KeyError/TypeError for dict access), keep inline disable on 6 genuinely polymorphic catches (ARM calls, K8s API, retry loops) - _troubleshootutils.py: keep module-level disable (21 catches, deferred to follow-up) * fix: resolve all azdev style (pylint) violations to 10.00/10 - W0707 raise-missing-from: add 'from e/ex/exc' to re-raises across custom.py, _utils.py, _precheckutils.py - C0209 consider-using-f-string: convert .format() calls to f-strings in custom.py, _utils.py, _client_factory.py - R1714 consider-using-in: merge comparisons in custom.py, _precheckutils.py, _troubleshootutils.py - C0207 use-maxsplit-arg: add maxsplit=1 in custom.py - W1514 unspecified-encoding: add encoding='utf-8' to open() calls across all files - C0206 consider-using-dict-items: use .items() iteration in custom.py - C0325 superfluous-parens: remove extra parens on raise in custom.py - E1101 no-member: inline disable for HttpResponseError.response in custom.py - Module-level pylint disables for: too-many-lines, too-many-positional-arguments, too-many-statements, consider-using-with (cannot refactor without breaking API) - R0915/R0917 inline disables in _params.py, clientproxyhelper/_utils.py, clientproxyhelper/_proxylogic.py * fix: resolve flake8 E203/E122/E125/E115 formatting errors - Fix misplaced encoding='utf-8' argument formatting in multi-line open() calls - Remove misplaced pylint disable comments inside except block - Add too-many-lines disable at module level in _utils.py * style: apply ruff format to pass CI formatting check * fix: add linter exclusion for require_wait_command_if_no_wait * fix: use bare raise in ValidationError except block per review * fix: use bare raise in ArgumentUsageError except block per review
…on (#56) * Add diagnosability to helm timeouts * update logic to ensure image pulls get priority, and ensure only one fault is emitted per failure * logging changes * update error messages * review fixes * only look at secret metadata to avoid secret leak * fix unwrapped exception * Update Error Codes --------- Co-authored-by: John McCormick <mccormickjo@microsoft.com>
* Pin ruff<0.16.0 to avoid breaking default rule changes * Fix W1203: use lazy % formatting in logger.debug calls * Fix I001: sort imports alphabetically in test_utils_.py * Apply ruff format to unformatted files
* prediag
* messagefix
* logprediagerrors
* historyupdate
* duplicatestring
* test
* fix: prediagnostic telemetry improvements
- Fix empty-log NotCompleted returning Passed instead of Incomplete
- Fix double telemetry firing (job-execution-error + check-failure)
- Fix NotApplicable for all checks when pod never ran
- Fix Entra/CRD error message parsing (filter non-error lines)
- Trim multi-line error messages to first line
- Add always-save log for completed jobs
- Add console diagnostic output block
- Add State 3 telemetry for LinuxNodeExists and ClusterRoleBindings
- Add Post_Diagnostic_Precheck_Fault_Type constant
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* prompt
* test: add unit tests for prediagnostic telemetry functions
- Add test_precheckutils.py with 14 unit tests covering:
- send_prediagnostic_job_execution_error_telemetry (error type, status, reason)
- send_prediagnostic_check_failure_telemetry (check results, error extraction,
multiline trimming, non-error line filtering)
- send_post_diagnostic_precheck_failure_telemetry (error type, check name/reason)
- Use sys.modules stubs to avoid heavy runtime dependencies
- Fix code corruption in _precheckutils.py (IDE selection leaked into source)
- Remove temporary debug helper (_debug_add_extension_event)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: use setdefault for stubs to allow real modules in azdev CI
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* linterrors
* linterrors
* testfixes
* fix unittest
* removingunexpetedfiles
* Fix test_utils_.py: add missing knack submodule stubs
* Replace debug print() with logger.debug() in telemetry functions
* Fix telemetry corruption caused by apostrophes in telemetry payloads
The CLI telemetry client uses json.loads(data.replace(chr(39), chr(34))) which
converts apostrophes to double quotes, breaking JSON parsing and dropping
entire telemetry batches.
Changes:
- _precheckutils.py: Replace Couldn't with Could not in set_exception calls
- custom.py: Replace Couldn't/couldn't with Could not/could not in set_exception calls,
remove single quotes around 'linux' in telemetry strings
- _utils.py: Strip apostrophes from helm_error_detail before add_extension_event calls
* Move telemetry key strings to constants
Address PR review: move Context.Default.AzureCLI.onboardingErrorType and
Context.Default.AzureCLI.onboardingErrorMessage to _constants.py as
Telemetry_Onboarding_Error_Type_Key and Telemetry_Onboarding_Error_Message_Key
* Address PR #54 review comments: refactor telemetry, add comments
- Extract common _send_onboarding_telemetry_event() helper
- Refactor check_results to generic list structure with componentName/checkResult/error
- Move job status and check result strings to _constants.py
- Select newest pod by creation_timestamp to avoid stale logs
- Extract _parse_entra_check_result() and _parse_crd_check_result()
- Revert helm chart version bump (separate PR)
- Replace print() with logger.warning() in custom.py
- Add clarifying comment for DNS error strings in _utils.py
- Add comprehensive comments throughout _precheckutils.py
* Fix prediagnostic telemetry: use set_exception, encode check results in fault_type
- Replace add_extension_event with set_exception for GDPR-whitelisted fields
- Encode individual check results (dns/outbound/entra/crd) in fault_type string
- Add common _send_onboarding_telemetry_event helper
- Convert print() calls to logger.debug()/logger.info()
- Select latest pod by creationTimestamp
- Extract _parse_entra_check_result into separate function
* refactor(telemetry): structured component list for prediagnostic check results
Address bgriddaluru PR review comments #2 and #3:
- Replace string-based error extraction with structured add_extension_event
payloads containing generic component lists [{componentName, checkResult, error}]
- ADX dashboard queries no longer need custom name parsing (dnsCheck, dnsError)
- Error details extracted from diagnoser_output by component keyword matching
- Wire up send_prediagnostic_check_failure_telemetry in fetch_diagnostic_checks_results
- Keep set_exception fault_type encoding for ADX backward compatibility
* Add informational telemetry for non-2xx outbound connectivity responses
During pre-onboarding diagnostics, when an outbound connectivity check
receives a non-2xx HTTP response (4xx/5xx) that is NOT a connection-level
failure (code 000), emit an informational extension event with fault type
'prediagnostics-outbound-non2xx-response'. This preserves the existing
PASS behavior while surfacing the unexpected response codes in ADX for
monitoring and investigation.
Changes:
- _constants.py: Add Outbound_Connectivity_Non2xx_Response_Type constant
- _utils.py: Emit telemetry in 3 code paths (cluster-connect, onboarding,
troubleshoot) when response code starts with '4' or '5'
- _precheckutils.py: Improve per-check telemetry emission with structured
fault descriptions and SERVFAIL detection
- Unit tests added for all new telemetry paths
Verified in ADX: events appear with correct fault type and message
containing endpoint, code, and target information.
* Replace standalone test scripts with Pester-format PrediagnosticTelemetry.Tests.ps1
* fix: ruff lint (PIE810), ruff format, and mypy type-arg errors for prediagnostic telemetry
* fix: ruff format test_precheckutils.py and test_utils_.py
* Remove per-component set_exception loop; send single aggregate fault per onboarding failure
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Address PR review: explain 404 in Entra check docstring, replace for-loop with if-guard for single pod
* Add wheel for E2E testing
* Add pylint disable comments for new code
* Fix global statement syntax for ruff compatibility
* Apply ruff format to PR files
* fix: restore onboarding_error_type usage in helm_error_detail (lint F841)
---------
Co-authored-by: Atchut Kumar Barli <atchut@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…dpoints (#61) * Add 'Arc' keyword for --proxy-skip-range to expand Azure Arc private-link endpoints * Add unit tests for Arc proxy-skip-range keyword expansion * Add Arc keyword help text * Bump Version * Revert "Bump Version" This reverts commit 6c4f3d0. Drops the 1.10.13 -> 1.10.14 version bump from the PR; the Arc proxy-skip-range feature can be published under a batched release bump instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: aa3f5a60-e3b1-49b4-a4e5-5d656000d376 * Text modify * Extract Arc proxy-skip-range endpoints into a constant and simplify help text Move the Arc private-link endpoint suffixes into a shared Arc_Private_Link_Endpoints constant and consume it from get_arc_proxy_skip_range_endpoints (behavior unchanged). Simplify the --proxy-skip-range help text and fold the Arc keyword into the existing examples, dropping the dedicated private-link example blocks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add proxy test for the Arc keyword in --proxy-skip-range Assert that 'az connectedk8s update --proxy-skip-range Arc' expands to the Azure Arc private-link endpoints in the agent noProxy value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Added dedup functionality and tests --------- Co-authored-by: Sai Tareesh Reddy Eppeti <seppeti@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: aa3f5a60-e3b1-49b4-a4e5-5d656000d376
…#67) * Fix pre-onboarding diagnostic checks grading NotCompleted job as Passed when partial container output is present * Update clusterdiagnosticchecks image version to 1.36.1 * Fix mypy no-any-return in get_cloud_based_domain: cast endpoints.active_directory to str before split * ruff format custom.py
|
Hi john mccormick (@jmccormick7), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR releases connectedk8s v1.11.2 and focuses on improving diagnosability and telemetry quality for key onboarding and proxy scenarios, including end-to-end correlation ID propagation for az connectedk8s proxy, richer pre-onboarding diagnostics, and better Helm-timeout failure classification.
Changes:
- Bump extension version to 1.11.2 and update release notes.
- Add correlation ID minting/propagation for
az connectedk8s proxyacross ARM calls and localhost arcProxy requests, with unit tests and a walkthrough doc. - Improve telemetry reliability and failure classification: prediagnostic telemetry, Helm-timeout diagnostics/classification, and proxy skip-range keyword expansion (
Arc).
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/connectedk8s/setup.py | Version bump to 1.11.2 and constrain ruff lint extra range. |
| src/connectedk8s/linter_exclusions.yml | Adds linter rule exclusion configuration for the extension. |
| src/connectedk8s/HISTORY.rst | Adds 1.11.2 release history entries. |
| src/connectedk8s/docs/correlation-id-flow.md | New detailed walkthrough doc for correlation ID propagation flow. |
| src/connectedk8s/azext_connectedk8s/tests/unittests/test_utils_.py | Expands unit coverage for Helm timeout / DNS parsing and redaction helpers; adds dependency stubbing. |
| src/connectedk8s/azext_connectedk8s/tests/unittests/test_precheckutils.py | New unit tests for prediagnostic telemetry helpers in _precheckutils.py. |
| src/connectedk8s/azext_connectedk8s/tests/unittests/test_custom.py | Adds unit tests for expand_proxy_skip_range_keywords and validates Arc keyword expansion across clouds. |
| src/connectedk8s/azext_connectedk8s/tests/unittests/test_correlation_id.py | New unit tests validating correlation ID propagation into SDK and requests calls. |
| src/connectedk8s/azext_connectedk8s/custom.py | Major updates: catch-all telemetry decorator, proxy correlation ID threading, Arc keyword expansion, additional telemetry events, and AGC handling for helm/kubectl. |
| src/connectedk8s/azext_connectedk8s/clientproxyhelper/_utils.py | Adds correlation header support for localhost requests and tightens exception handling. |
| src/connectedk8s/azext_connectedk8s/clientproxyhelper/_proxylogic.py | Threads correlation ID into ARM credential fetch and proxy registration calls. |
| src/connectedk8s/azext_connectedk8s/clientproxyhelper/_binaryutils.py | Minor formatting/readability update for proxy filename construction. |
| src/connectedk8s/azext_connectedk8s/action.py | Refines pylint disables and adds explanatory comments. |
| src/connectedk8s/azext_connectedk8s/_utils.py | Adds Helm timeout diagnostics/classification, correlation-id helper, and multiple robustness/telemetry improvements. |
| src/connectedk8s/azext_connectedk8s/_troubleshootutils.py | Adds encoding to file writes and refines lint suppressions in troubleshooting flow. |
| src/connectedk8s/azext_connectedk8s/_precheckutils.py | Adds structured prediagnostic telemetry helpers, improved log parsing, and more explicit job status handling. |
| src/connectedk8s/azext_connectedk8s/_params.py | Updates --proxy-skip-range help text and removes workload identity preview flags. |
| src/connectedk8s/azext_connectedk8s/_help.py | Updates examples to include Arc keyword in --proxy-skip-range. |
| src/connectedk8s/azext_connectedk8s/_constants.py | Adds new constants for correlation header, Helm timeout diagnostics, prediagnostic telemetry, and updates images/versions. |
| src/connectedk8s/azext_connectedk8s/_client_factory.py | Minor formatting update for Authorization header construction. |
| .github/CODEOWNERS | Updates code owners for /src/connectedk8s/. |
Suppressed comments (4)
src/connectedk8s/azext_connectedk8s/custom.py:2607
telemetry.set_exceptionis being passed a raw string here. If the goal is to avoid telemetry "Unknown" errors caused by non-exception inputs, wrap the message in an Exception (consistent with the other updates in this PR).
telemetry.set_exception(
exception=consts.No_Param_Error,
fault_type=consts.Update_No_Params_Fault_Type,
summary="No update parameters specified",
)
src/connectedk8s/azext_connectedk8s/custom.py:2616
telemetry.set_exceptionis being passed a raw string here (consts.EnableProxy_Conflict_Error). If string exceptions are what was causing telemetry parsing issues, this should also be wrapped in an Exception for consistency.
telemetry.set_exception(
exception=consts.EnableProxy_Conflict_Error,
fault_type=consts.Update_Proxy_Conflict_Fault_Type,
summary="Proxy enable and disable specified simultaneously",
)
src/connectedk8s/azext_connectedk8s/custom.py:2649
telemetry.set_exceptionis being passed a raw string here. To avoid the telemetry "Unknown"/misclassification issues this PR is addressing, wrap the message in an Exception object.
telemetry.set_exception(
exception="Connected cluster resource 'id' is None",
fault_type=consts.Connected_Cluster_Resource_Id_None_Fault_Type,
summary="Connected cluster ARM resource missing 'id' field",
)
src/connectedk8s/azext_connectedk8s/custom.py:2850
telemetry.set_exceptionis being passed a raw string here. If telemetry parsing expects a real Exception (as other changes in this PR suggest), this should also be wrapped to avoid "Unknown" errors.
telemetry.set_exception(
exception="Timed out waiting for Agent State to reach terminal state",
fault_type=consts.Agent_State_Timeout_Fault_Type,
summary="Agent state did not reach terminal state within timeout during update",
)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| connectedk8s: | ||
| rule_exclusions: | ||
| - require_wait_command_if_no_wait |
|
|
||
| --- | ||
|
|
||
| **End of walkthrough.** See [`correlation-id-propagation.md`](correlation-id-propagation.md) for the design rationale and [`test_correlation_id.py`](../azext_connectedk8s/tests/unittests/test_correlation_id.py) for the unit test coverage. |
| telemetry.set_exception( | ||
| exception="Timed out waiting for Agent State to reach terminal state", | ||
| fault_type=consts.Agent_State_Timeout_Fault_Type, | ||
| summary="Agent state did not reach terminal state within timeout during create", | ||
| ) |
| def get_cloud_based_domain(cmd: CLICommand) -> str: | ||
| active_directory_array = str(cmd.cli_ctx.cloud.endpoints.active_directory).split( | ||
| "." | ||
| ) | ||
| # default for public, mc, ff clouds |
| filepath_with_timestamp, | ||
| "cluster_diagnostic_checks_job_log.txt", | ||
| ) | ||
| with open(log_path, "w+") as f: |
| for mod, stub in _STUBS.items(): | ||
| sys.modules.setdefault(mod, stub) | ||
|
|
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Live test results —
|
There was a problem hiding this comment.
Automated Review Summary
Result: All checks passed ✅
- Live test (issue-sentinel
live-test.yml): success — reused the existing completed run for head SHA7140824a. - CI checks: 44/44 completed, 40 passed, 0 failed, 0 pending.
No outstanding issues found. This PR (connectedk8s: release v1.11.2) looks ready from an automation standpoint.
|
[Release] Update index.json for extension [ connectedk8s-1.11.2 ] : https://dev.azure.com/msazure/One/_build/results?buildId=177422884&view=results |
🤖 PR Validation — ️✔️ All clear
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az connectedk8s
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install azdevrequired)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.jsonautomatically.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.