Skip to content

{Dataprotection} Isolate AKS backup vault discovery - #10309

Merged
Julie Zhu (yanzhudd) merged 1 commit into
Azure:mainfrom
FumingZhang:fix/dataprotection-aks-backup-vault-rca-20260907
Sep 8, 2026
Merged

{Dataprotection} Isolate AKS backup vault discovery#10309
Julie Zhu (yanzhudd) merged 1 commit into
Azure:mainfrom
FumingZhang:fix/dataprotection-aks-backup-vault-rca-20260907

Conversation

@FumingZhang

@FumingZhang FumingZhang commented Sep 7, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes
️✔️ None

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

Related command

az dataprotection enable-backup trigger

What / Why

Fixes a race in AKS backup setup when multiple runs operate in the same subscription:

  • Scope reusable backup vault discovery to the resolved backupResourceGroupId instead of searching the entire subscription for a location-tagged vault. This prevents concurrent runs from sharing a vault that another run may delete during cleanup.
  • Poll a newly created backup vault's service-visible provisioningState with bounded retries before starting dependent role-assignment and backup-instance operations.
  • Add regression coverage for resource-group scoping, tag matching, transient state polling, terminal failures, and bounded retries.

Validation

  • pytest src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_enable_backup.py -q - 48 passed.
  • flake8 on the changed helper and test files using the extension's configured ignores - passed.
  • python -m py_compile for all changed Python files - passed.
  • git diff --check upstream/main...HEAD - passed.

Scope / Index / History

  • Dataprotection extension version is bumped from 1.11.4 to 1.11.5.
  • HISTORY.rst contains the matching 1.11.5 release note.
  • src/index.json is not modified; it will be updated by the post-merge automation.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required) - azdev is unavailable locally; targeted flake8, syntax, and unit checks passed, and the PR's style workflow provides the repository check.
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required) - N/A, src/index.json is unchanged.
  • My extension version conforms to the Extension version schema.

For new extensions:

  • N/A - not a new extension.

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi FumingZhang,
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 pyproject.toml (or setup.py, if the extension has not migrated yet) 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.

🟢 Approval recommended

The functional changes and regression tests align with the PR’s race-condition goals, with only a minor docstring contract clarification suggested.

Pull request overview

This PR updates the az dataprotection enable-backup trigger AKS flow to avoid cross-run races by scoping backup vault discovery to the caller’s resolved backup resource group and by waiting for a newly created vault’s service-visible provisioningState before proceeding with dependent operations.

Changes:

  • Scope tag-based backup vault discovery to the explicit backup resource group (instead of subscription-wide search).
  • Add bounded polling for backup vault provisioningState after create to reduce eventual-consistency failures.
  • Bump extension version to 1.11.5 and add matching release notes, plus regression unit tests for the new behaviors.
File summaries
File Description
src/dataprotection/setup.py Bumps dataprotection extension version to 1.11.5.
src/dataprotection/HISTORY.rst Adds 1.11.5 release note describing the vault discovery + readiness wait changes.
src/dataprotection/azext_dataprotection/manual/aks/aks_helper.py Implements resource-group-scoped vault discovery and bounded vault readiness polling.
src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_enable_backup.py Adds unit coverage for RG scoping, tag matching, polling success/failure, and bounded retries.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +698 to +705
Scoping the ``list`` call to ``backup_resource_group_name`` (derived from
the caller-supplied ``backupResourceGroupId``, or the per-cluster
resource group we just created/validated) is required: without it, every
parallel run/test that happens to omit ``backupResourceGroupId`` shares
the same subscription-wide, tag-matched vault, so one run's
``aks delete``/vault cleanup can race another run's discovery and lookup
(``ResourceGroupBeingDeleted``/404 on the shared vault). Restricting
discovery to the caller's own resource group keeps each run isolated.
Honor backupResourceGroupId when locating reusable vaults so concurrent AKS backup runs cannot race over unrelated subscription-level matches. Poll newly created vaults for a service-visible terminal state before dependent role and backup operations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@FumingZhang
FumingZhang force-pushed the fix/dataprotection-aks-backup-vault-rca-20260907 branch from e21903a to fc9782b Compare September 7, 2026 06:41
@yonzhan

Copy link
Copy Markdown
Collaborator

dataprotection

@yanzhudd
Julie Zhu (yanzhudd) merged commit 90d34c6 into Azure:main Sep 8, 2026
24 checks passed
@azclibot

Copy link
Copy Markdown
Collaborator

[Release] Update index.json for extension [ dataprotection-1.11.5 ] : https://dev.azure.com/msazure/One/_build/results?buildId=180062234&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants