Skip to content

feat(velero): show restore scope — namespace mapping and label selectors - #1571

Open
hisco wants to merge 1 commit into
mainfrom
eyal/rad-403-velero-restore-scope
Open

feat(velero): show restore scope — namespace mapping and label selectors#1571
hisco wants to merge 1 commit into
mainfrom
eyal/rad-403-velero-restore-scope

Conversation

@hisco

@hisco hisco commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Problem

The Velero Restore detail renderer showed included/excluded namespaces and resources, but never surfaced spec.namespaceMapping or label selectors, and it gated its Scope section only on namespaces/resources. So:

  • spec.namespaceMapping (source → target namespace remap) was invisible — an operator couldn't see where a restore would land.
  • A restore scoped only by a label selector rendered no Scope section at all.

Fix

Add namespace mapping and label selectors to the Scope section, reusing the shared components:

  • namespaceMapping rendered as source → target rows.
  • labelSelector / orLabelSelectors via the shared LabelSelectorDisplay (never hand-rolled).
  • The section gates on non-empty terms, so an empty {} selector (which matches everything) does not force a spurious "matches all" Scope box.

Layout, badge tokens, and label style match the sibling Backup renderer.

Tests

Added renderer tests: namespace mapping shown (source → target), label selector shown, an or-selector shown, a label-only restore now renders Scope, and unscoped / empty-selector restores render no Scope section — the positive assertions fail against the pre-fix code. Full k8s-ui suite passes with no regressions.

Ticket: RAD-403 (Velero/CNPG/Kyverno review).

https://claude.ai/code/session_01KxZ3xt2G4KpexrKSoXQ91S


Note

Low Risk
Read-only k8s-ui display and test changes for Velero restore details; no cluster API or restore execution behavior.

Overview
The Velero Restore detail drawer now surfaces namespace mapping and label selectors in Scope, so operators can see remap targets and label-only filters—not only included/excluded namespaces and resources.

Scope appears when any of those fields (or mapping / non-empty selectors) are set. Namespace Mapping renders source → target rows; labelSelector and orLabelSelectors use shared LabelSelectorDisplay. Empty {} selectors are ignored so the UI does not imply a filter when Velero would match everything.

Velero restore helpers add getRestoreNamespaceMapping, selector getters, and hasLabelSelectorTerms. Renderer tests cover mapping, selectors, label-only scope, and no spurious Scope for unscoped or empty-selector restores.

Reviewed by Cursor Bugbot for commit 3f5be4a. Bugbot is set up for automated code reviews on this repo. Configure here.

The Velero Restore detail view showed included/excluded namespaces and
resources but never surfaced spec.namespaceMapping (which remaps source
namespaces to different targets on restore) or the label selectors that
narrow a restore. A restore filtered only by a label selector rendered no
Scope section at all, so an operator could not see what the restore would
touch or where its data would land.

Add Namespace Mapping (source to target), Label Selector, and Label
Selectors (match any) to the Scope section, reusing the shared
LabelSelectorDisplay component. Gate the section and each label-selector
row on non-empty terms so an unscoped restore renders no empty section and
an empty selector is not presented as scope.

Claude-Session: https://claude.ai/code/session_01KxZ3xt2G4KpexrKSoXQ91S
@hisco
hisco requested a review from nadaverell as a code owner August 31, 2026 11:37
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.

1 participant