feat(velero): show restore scope — namespace mapping and label selectors - #1571
Open
hisco wants to merge 1 commit into
Open
feat(velero): show restore scope — namespace mapping and label selectors#1571hisco wants to merge 1 commit into
hisco wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Velero
Restoredetail renderer showed included/excluded namespaces and resources, but never surfacedspec.namespaceMappingor 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.Fix
Add namespace mapping and label selectors to the Scope section, reusing the shared components:
namespaceMappingrendered as source → target rows.labelSelector/orLabelSelectorsvia the sharedLabelSelectorDisplay(never hand-rolled).{}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, andhasLabelSelectorTerms. 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.