Skip to content

[k8s-extension] Propagate non-404 delete lookup failures - #10528

Open
Alima Azamat (alimaazamat) wants to merge 1 commit into
Azure:mainfrom
alimaazamat:alimaazamat/k8s-extension-delete-errors
Open

Alima Azamat (alimaazamat) wants to merge 1 commit into
Azure:mainfrom
alimaazamat:alimaazamat/k8s-extension-delete-errors

Conversation

@alimaazamat

@alimaazamat Alima Azamat (alimaazamat) commented Oct 27, 2026 •

Copy link
Copy Markdown

🤖 PR Validation — ️✔️ All clear

Breaking Changes Suppressions
️✔️ None ️✔️ None

Summary

Fix the shared k8s-extension delete implementation returning success when its initial extension lookup fails for reasons other than HTTP 404.

  • Treat only HTTP 404 as already deleted, preserving the existing warning and idempotent behavior.
  • Propagate authorization, throttling, service, and unknown-status errors without calling partner cleanup or deletion.
  • Add regression tests exercising the real delete implementation with a failing client.get, plus successful-delete argument forwarding.
  • Prepare k8s-extension version 1.9.5 with a release-history entry.

Review scope and related PRs

Split out for independent review by the k8s-extension module owners:

This PR contains no aks-preview or generated-index changes and is based on current main.

The AKS wrappers delegate to the installed k8s-extension package. Their normal create/show/list/update paths do not depend on this fix. Correct propagation of non-404 lookup failures during deletion requires this corrected dependency to be published and installed; updating aks-preview alone does not update the dependency. No minimum-version gate is added by this PR.

Validation

  • On this branch: 18 dependency/custom/Fleet unit tests passed.
  • The regression tests reproduced six swallowed-error cases before the fix: HTTP 401, 403, 429, 500, 503, and an error with no status code.
  • The identical patch previously passed azdev style k8s-extension, the repository-scoped command linter, and index tests (9 tests, 2 skipped); the 1.9.5 wheel built successfully.
  • No live deletion was performed; existing development-cluster extensions were left intact.

Keep deletion idempotent for missing extensions while surfacing authorization, throttling, and service failures. Cover the real delete delegate with lookup-failure regression tests and prepare the 1.9.5 dependency release.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3e9999ee-7df3-4e69-9868-14375740b6b3
Copilot AI balanced review requested due to automatic review settings October 27, 2026 17:37
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Alima Azamat (@alimaazamat)! We will review the pull request and get back to you soon.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Auto-Assign Auto assign by bot label Oct 27, 2026

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.

🟢 Approval recommended

The localized fix preserves existing 404 and successful-delete behavior, with focused regression coverage and no unresolved blocking issues.

No open issues 🎉

What changed in this PR

Corrects the shared k8s-extension delete implementation so failed lookups no longer report success unless the response is HTTP 404. AKS wrappers benefit once the corrected dependency is published and installed.

Changes:

  • Preserve idempotent deletion for HTTP 404 and propagate all other lookup errors.
  • Add regression coverage for lookup failures, skipped cleanup/deletion, and successful-delete argument forwarding.
  • Prepare version 1.9.5 with a release-history entry.
File Description
src/​k8s-extension/​setup.py Bumps the package version to 1.9.5.
src/​k8s-extension/​HISTORY.rst Documents the delete error-propagation fix.
src/​k8s-extension/​azext_k8s_extension/​tests/​latest/​test_custom.py Tests 404 handling, other lookup failures, and successful deletion.
src/​k8s-extension/​azext_k8s_extension/​custom.py Re-raises non-404 lookup errors before cleanup or deletion.

Review effort: Balanced

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

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 customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants