Skip to content

Add ownership tracking for Arc proxy bypass. - #96

Merged
Tareesh21 merged 3 commits into
mainfrom
bypass_proxy
Oct 6, 2026
Merged

Tareesh21 merged 3 commits into
mainfrom
bypass_proxy

Conversation

@Tareesh21

Copy link
Copy Markdown

Summary

The CLI now records the proxy skip range separately from the Arc endpoint contribution. This allows skip-range replacement to preserve recorded Arc bypass, while clearing Arc retains entries supplied through --proxy-skip-range, including overlapping Arc endpoints.

Behaviour Changes

connect

Path Behaviour
Fresh onboarding with --add-proxy-bypass Arc Saves the final noProxy list and the Arc ownership information together in one Helm operation.
Supported gateway reconnect When adding Arc bypass, reads the existing Helm release and keeps the proxy skip range unless a new --proxy-skip-range is provided.
Reconnect without a gateway Skips ownership checks and their preservation/overlap warnings. An explicit --add-proxy-bypass Arc request is still rejected, before ownership is read.

update

Base Command

az connectedk8s update -g RG -n CLUSTER `
  --proxy-skip-range 10.0.0.0/8 `
  --add-proxy-bypass Arc

This saves 10.0.0.0/8 as the proxy skip range, adds the required Arc endpoints to noProxy, and records Arc ownership.

global.noProxy = 10.0.0.0/8, 3<Arc>

The examples below show subsequent requests against this cluster. Each Request below starts independently from the configuration created by the base command.

Request Result
--proxy-skip-range 172.16.0.0/12 Replaces the saved range and keeps Arc enabled: 172.16.0.0/12,<arc>.
--add-proxy-bypass Arc Preserves the saved range and avoids duplicate endpoints.
--clear-proxy-bypass Arc Keeps 10.0.0.0/8 and clears ownership.
--clear-proxy-bypass Arc --proxy-skip-range .his.arc.azure.com Keeps the newly supplied .his.arc.azure.com and clears ownership.
An unrelated update with no Arc or skip-range input Leaves the range and ownership unchanged without an ownership read.

<arc> represents the Arc endpoint suffixes. Each row starts from the same initial state.

Additional handling:

  • The proxy skip range can contain some or all Arc endpoints. Adding or preserving Arc bypass warns about this overlap. Clearing Arc bypass keeps entries from the saved or newly supplied skip range.
  • If clearing Arc bypass leaves no skip-range entries, the CLI explicitly sets global.noProxy to an empty string.
  • Without saved ownership, the CLI does not assume Arc bypass was enabled just because Arc endpoints appear in noProxy. Clearing Arc bypass warns instead of removing matching endpoints. Any requested skip-range replacement still applies normally.
  • If the ownership record is invalid, or its saved effective range does not match the current noProxy, the CLI raises AZK8S0107 before changing the Helm release.

Ownership Storage

Ownership is stored in the existing azure-arc Helm release under connectedk8sCli.arcProxyBypass.

Field Purpose
userNoProxy Raw proxy skip range, kept separately from Arc's contribution.
noProxy Raw effective list used to detect changes outside the ownership flow.

The record is Base64-encoded JSON so it passes through the existing Helm --set handling as one string. The CLI decodes it when reading ownership.

The effective list comparison ignores order, case, whitespace, and duplicates. Clearing supplies "null" for the ownership value while writing the remaining skip range.

Implementation

custom.py

Function Description
update_connected_cluster Sends the final global.noProxy and Arc ownership values together to Helm. Explicitly sends an empty global.noProxy when clearing Arc bypass leaves no entries.
add_arc_proxy_skip_range_endpoints Adds the required Arc endpoints to the proxy skip range and removes duplicates case-insensitively, keeping the first spelling and order.
build_arc_proxy_bypass_settings Builds the combined noProxy list and records both the proxy skip range and the combined list. Returns the combined list and the Base64-encoded JSON ownership record.
get_arc_proxy_bypass_user_range Reads and decodes the ownership record from Helm values, validates its format, and compares its saved noProxy with the current list. Returns the saved skip range, or None if ownership is missing. Rejects invalid or mismatched records.
resolve_arc_proxy_bypass Calculates the next noProxy and ownership values. Adds Arc endpoints when requested, preserves recorded Arc bypass during skip-range replacement, and clears owned Arc bypass while keeping the saved or newly supplied skip range.
remove_arc_proxy_skip_range_endpoints Removed. Clearing Arc bypass now keeps the saved or newly supplied skip range instead of deleting entries simply because they match Arc endpoints.
validate_arc_proxy_bypass_clear Removed. A clear request can now include a new --proxy-skip-range containing Arc endpoints; those endpoints remain because they were explicitly supplied in the skip range.

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? (pip install wheel==0.30.0 required)
  • 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.

@github-actions

Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions

Copy link
Copy Markdown

Hi @Tareesh21

Release Suggestions

Module: connectedk8s

  • Please log updates into to src/connectedk8s/HISTORY.rst
  • Update VERSION to 2.0.0 in src/connectedk8s/setup.py

Notes

@Tareesh21
Tareesh21 merged commit 68bbea3 into main Oct 6, 2026
31 checks passed
@Tareesh21
Tareesh21 deleted the bypass_proxy branch October 6, 2026 04:28
ashnanze pushed a commit that referenced this pull request Oct 6, 2026
* Track Arc proxy bypass ownership

* Fix unit tests and ruff formatting

---------

Co-authored-by: Sai Tareesh Reddy Eppeti <seppeti@microsoft.com>
github-actions Bot pushed a commit that referenced this pull request Oct 14, 2026
* Update onboarding flow to inject kubernetes secret without using helm (#47)

* Update onboarding flow to inject kubernetes secret without using helm
values

* add whl file for testing

* update whl file after rebase

---------

Co-authored-by: John McCormick <mccormickjo@microsoft.com>

* Report ARM ID in command and fault telemetry  (#59)

* add wrapper for telemetry that adds ArmId to payload

* add standardized error data type and methods

* update other telemetry call sites for errors to use centralized error
wrapper

* update helm get values failure to use new error reporting, and add
documentation

* update test and pass ruff checks

* fix argument error from rebase

---------

Co-authored-by: John McCormick <mccormickjo@microsoft.com>

* Update client proxy version (#72)

* Fix linting issues, and Update CI checks (#76)

* add a git workflow to update sync/upstream-main and add release docs

* fixing azdev pipelines and cli testing passthrough

* update azdev pipelines, and use federated credential for ado pipeline

* update CLI testing

* update cli testing to use github auth

* chore: retrigger ADO PR validation

* fix formatting issues for CI, and remove cli wide test that fails on a missing ref

* improve efficiency and fix version calculation

* ruff formatting

---------

Co-authored-by: John McCormick <mccormickjo@microsoft.com>

* Fix/connectedk8s prediagnostic job completion (#80)

* fix(connectedk8s): reconcile diagnostic job completion

* test(connectedk8s): cover diagnostic job outcomes

* fix(connectedk8s): extend diagnostic job timeout

* refactor(connectedk8s): rely on extended diagnostic timeout

* chore(connectedk8s): remove test attribution comment

* feat(connectedk8s): explain incomplete diagnostic jobs

* fix(connectedk8s): remove unused noqa directives

* chore(connectedk8s): retrigger validation pipeline

* fix(connectedk8s): resolve ruff style failures

* fix(connectedk8s): suppress delayed import lint

* fix(connectedk8s): suppress diagnostic helper return lint

* Adding AZK8S0600-0699 pre-onboarding diagnostic error codes (#81)

* feat(connectedk8s): add AZK8S0600-0699 pre-onboarding diagnostic error codes

Add structured error code infrastructure and wire the 0600-0699 range
(pre-onboarding diagnostics) so users see actionable codes in errors and
warnings instead of raw messages.

New file:
- _error_codes.py: ERROR_CATALOG dict (full range 0001-0805) plus
  raise_with_code() and warn_with_code() helpers that prepend the code
  to the message and emit telemetry in a single call.

_constants.py:
- Added AZK8S0600-AZK8S0607 error code constants.

_precheckutils.py:
- Import raise_with_code, warn_with_code from _error_codes.
- AZK8S0604: job not scheduled -> warn_with_code (non-fatal).
- AZK8S0606: log save failed (OSError + ValueError/TypeError) -> warn_with_code (non-fatal).
- AZK8S0605: job not complete -> warn_with_code (non-fatal).
- AZK8S0601: outer except in executing_cluster_diagnostic_checks_job -> raise_with_code(CLIInternalError).
- AZK8S0607: helm install of diagnostic checks chart failed -> raise_with_code(CLIInternalError).

custom.py:
- Import raise_with_code from _error_codes.
- AZK8S0600: outer except wrapping fetch_diagnostic_checks_results -> raise_with_code(CLIInternalError).
- AZK8S0603: Diagnostic_Check_Incomplete -> raise_with_code(ValidationError).
- AZK8S0602: Diagnostic_Check_Failed -> raise_with_code(ValidationError).

* fix(connectedk8s): preserve prediagnostic error classifications

* docs(connectedk8s): clarify error classification

* Update csp version (#85)

* Implement Helm Error Code Standardization (AZK8S05XX) (#73)

* add helm errors

* update precheck utils to raise the helm errors for helm client failures

* introduce generic Helm client error and fix cmd typing and error supression

* update tests

* remove whl

* fixes

* add arm id to prechecks + troubleshooting telemetry + remove helm url

helm url could contain credentials so removing from telemetry

* fix param issue in delete_arc_agents

* ruff format and simplify if statment

* fix unittest

* update test inputs

* fixes

* update stub to use kwargs as well

* update helm checks and sanitize telemetry payload

* move logging, and raise in place

---------

Co-authored-by: John McCormick <mccormickjo@microsoft.com>

* Proxy Bypass for Arc Service endpoints and Container Insights. (#86)

* Add Container Insights proxy bypass constants and utils

* Add --proxy-bypass and --clear-proxy-bypass parameters

* Apply Container Insights proxy bypass during connect

* Apply Container Insights proxy bypass only when its keyword is specified

* Remove Arc keyword from --proxy-skip-range

* Add Arc keyword to proxy bypass constants

* Rename --proxy-bypass to --add-proxy-bypass and validate keywords

* Add proxy bypass parameters to update

* Append Arc endpoints to noProxy during connect

* Preserve Arc proxy bypass across update

* Remove Arc endpoints from noProxy during update

* Add Container Insights proxy bypass into update

* Update comment for Container Insights

* Set Container Insights proxy bypass to false on clear

* Remove Container Insights proxy bypass on delete

* Clear stale Container Insights proxy bypass on re-onboard

* Allow clearing the Arc proxy bypass with a new skip range

* Add proxy bypass keywords in help

* Add tests for the proxy bypass keywords

* To address proxy bypass naming, messages and tests

* Add telemetry to Container Insights ConfigMap failures.

* Fix missing cmd argument in helm values call and apply ruff format

---------

Co-authored-by: Sai Tareesh Reddy Eppeti <seppeti@microsoft.com>

* Standardize custom locations errors (AZK8S0700–AZK8S0702) (#90)

* feat(connectedk8s): standardize custom locations errors

* test(connectedk8s): verify custom locations telemetry

* Standardize network and connectivity errors (AZK8S0300–AZK8S0309) (#87)

* feat(connectedk8s): standardize network connectivity errors

* fix(connectedk8s): suppress outbound check local count lint

* docs(connectedk8s): clarify network error handling

* fix(connectedk8s): consolidate network diagnostic telemetry

* Add AGC Endpoint Configuration for Agent installation and Client-Side Proxy Operation (#68)

Add AGC Endpoint Configuration for Agent installation and Client-Side Proxy Operation

Added the AGC Helm override for MsiAdapterArtifactImageRegistry
Passing CloudConfig for Client-Side Proxy Scenario in AGC since default cloud name isn't supported.

* Implement kubectl/ Cluster Access Error Standardization (AZK8S02XX) (#74)

* Standardize network and connectivity errors (AZK8S0300–AZK8S0309) (#87)

* feat(connectedk8s): standardize network connectivity errors

* fix(connectedk8s): suppress outbound check local count lint

* docs(connectedk8s): clarify network error handling

* fix(connectedk8s): consolidate network diagnostic telemetry

* Add AGC Endpoint Configuration for Agent installation and Client-Side Proxy Operation (#68)

Add AGC Endpoint Configuration for Agent installation and Client-Side Proxy Operation

Added the AGC Helm override for MsiAdapterArtifactImageRegistry
Passing CloudConfig for Client-Side Proxy Scenario in AGC since default cloud name isn't supported.

* add error type for failed to inject private key

* initial error implementation

* standardize cmd type and add logger.warning to connectedk8s warning telemetry function

* ruff format

* fixes to telemetry

* update az error classes for kubectl errors

* restore no raising error to namespace cleanup on delete

* update errors to pass in the underlying exception type

* ruff format

* test(connectedk8s): remove misplaced proxy error tests

Keep the proxy error coverage on the proxy-errors branch while correcting the unrelated Kubernetes exception expectations and namespace cleanup clock mock.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ensure only one telemetry event and no duplicates

* remove duplicate faults

* update telemetry to strip apostrophes for AZ telemetry

* ruff

* linting fixes

* fix(connectedk8s): remove duplicate command context arguments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix duplicate telemetry

* ruff format

* fix indentation

* chore: retrigger mergability+pr checks

---------

Co-authored-by: Ashlee Nanze <ashleenanzework@gmail.com>
Co-authored-by: junw98 <junweihe@microsoft.com>
Co-authored-by: John McCormick <mccormickjo@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ARM operation Error Handling/Telemetry (AZK8S04XX) (#82)

* add in ARM operation error handling/reporting

* ruff format

* fix(connectedk8s): sanitize telemetry payloads

Apply the shared redaction helpers to standardized errors and extension event values while preserving ARM resource IDs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(connectedk8s): preserve telemetry exception types

Keep sanitized exception messages without collapsing fault classification, and cover command and ARM boundaries against duplicate fault emission.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(connectedk8s): type sanitized exception

Bind the dynamically created telemetry exception to BaseException so strict mypy does not infer an Any return.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* refactor(connectedk8s): consolidate ARM helpers

Parameterize connected-cluster PUT and GET helpers by operation while preserving operation-specific telemetry and error definitions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fixes to telemetry sanitization

* dont block onboarding for couldn't check provider registration

* fix(connectedk8s): harden telemetry field redaction

Redact case-insensitive JSON and key-value credential fields while preserving quoting and avoiding similarly named non-sensitive fields.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: John McCormick <mccormickjo@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add Proxy Pester Tests and restrict Arc bypass on reconnect. (#94)

* Announce the Arc proxy bypass only where it reaches the agents

* Refuse the Arc proxy bypass while reconnecting

* Only treat a complete Arc endpoint set as the proxy bypass

* Add end-to-end tests for the proxy bypass

* Refuse clearing the Arc proxy bypass while the skip range lists it

---------

Co-authored-by: Sai Tareesh Reddy Eppeti <seppeti@microsoft.com>

* Update dns result parsing to ignore transient issues (#93)

* update dns result parsing to ignore transient issues

* ruff

* reject invalid IP and take last error

---------

Co-authored-by: John McCormick <mccormickjo@microsoft.com>

* Client Proxy Error Code Reporting/Telemetry (AZK8S08XX) (#83)

* add client proxy error reporting

* test(connectedk8s): add client proxy error coverage

Cover client proxy error classification, legacy fault aliases, and preserved ARM credential error handling on the proxy-errors branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(connectedk8s): sanitize telemetry error payloads

Move recommendation handling to the raising reporter, sanitize event properties and exception messages, and cover apostrophe-bearing proxy failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: John McCormick <mccormickjo@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add helm override for kube state metrics repository (#95)

Add helm override for kube-state-metrics repository

* Standardize configuration input errors (AZK8S0100-AZK8S0106) (#92)

* Standardize configuration input errors (AZK8S0100-AZK8S0106)

* Remove generated test attribution comments

* Fix gateway resource ID type checking

* Fix connectedk8s unhandled error telemetry coverage (#91)

* fix(connectedk8s): standardize unhandled error telemetry

* fix(connectedk8s): preserve classified proxy errors in tests

* Add ownership tracking for Arc proxy bypass. (#96)

* Track Arc proxy bypass ownership

* Fix unit tests and ruff formatting

---------

Co-authored-by: Sai Tareesh Reddy Eppeti <seppeti@microsoft.com>

* chore(connectedk8s): prepare 1.11.4 release

* Fix connectedk8s 1.11.4 release review findings (#102)

* Sanitize prediagnostic log telemetry

* Fix prediagnostic telemetry command context

* Preserve proxy bypass compatibility

* Patch existing onboarding private key secret

* Format proxy bypass compatibility test

* Remove legacy Arc proxy skip range alias

* Reject removed Arc proxy skip range alias

* Revert "Reject removed Arc proxy skip range alias"

This reverts commit 6701f1e.

* Fix connectedk8s test secret scan (#103)

* Fix MCR precheck to use HTTPS (#104)

* Revert manual connectedk8s history update

* Restore connectedk8s 1.11.4 release history

---------

Co-authored-by: john mccormick <123213439+jmccormick7@users.noreply.github.com>
Co-authored-by: John McCormick <mccormickjo@microsoft.com>
Co-authored-by: shlokpatel57 <shlokpatel@microsoft.com>
Co-authored-by: Tareesh <saitareeshreddy12@gmail.com>
Co-authored-by: Sai Tareesh Reddy Eppeti <seppeti@microsoft.com>
Co-authored-by: junw98 <junweihe@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants