Skip to content

Velero/backup coverage phase 2 - #1326

Merged
illume merged 13 commits into
headlamp-k8s:mainfrom
Pragati5-DEBUG:velero/backup-coverage-phase-2
Oct 18, 2026
Merged

illume merged 13 commits into
headlamp-k8s:mainfrom
Pragati5-DEBUG:velero/backup-coverage-phase-2

Conversation

@Pragati5-DEBUG

Copy link
Copy Markdown
Contributor

Summary

Adds Phase 2 cluster-wide Velero views for Headlamp (kubernetes-sigs/headlamp#5198), building on Phase 1 coverage panels (#877).

  • Sidebar Velero with Schedules, Backups, and Coverage gaps
  • Schedule / Backup list + detail pages (cron, status, next run, last backup, phase, triggered-by)
  • Coverage gaps: namespaces and Deployments/StatefulSets with no matching Schedule
  • Coverage / schedule views load Backups via velero.io/schedule-name label selector (latest per schedule), addressing the Phase 2 scale note from review — Backups list still shows the full table
  • Velero sidebar icon + install check empty state
  • Test fixtures for Schedules / Backups demo

Test plan

  • cd velero && npm test (and Prettier/lint clean)
  • Apply fixtures (test-files/) on a cluster with Velero CRDs
  • Sidebar → Velero → Schedules / Backups / Coverage gaps load
  • Schedule detail shows cron, next run, last backup when Backup CRs exist
  • Coverage gaps lists uncovered namespaces/workloads
  • Deployment/STS/PVC/Namespace detail panels still show Phase 1 coverage
  • Settings → Plugins → Velero namespace still filters Schedule/Backup lists
Screen.Recording.2026-10-03.131847.mp4

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.

Copilot review overview

🟡 Changes recommended

The promised Coverage gaps view is absent, and selector, scaling, and coverage edge cases remain unresolved.

Review effort: Balanced
Findings: 2 High severity · 3 Medium severity · 2 Low severity

Open (7)
What changed in this PR

Adds a read-only Velero plugin with contextual backup coverage and cluster-wide resource views.

Changes:

  • Adds Schedule, Backup, and Restore list/detail pages and navigation.
  • Implements coverage matching, cron calculations, status display, and filtered backup loading.
  • Adds configuration, tests, documentation, and manual fixtures.
File Description
velero/​tsconfig.json Configures TypeScript.
velero/​test-files/​web-label-only-schedule.yaml Adds label-based Schedule fixture.
velero/​test-files/​sample-schedule.yaml Adds Schedule and Deployment fixtures.
velero/​test-files/​sample-restores.yaml Adds Restore fixtures.
velero/​test-files/​sample-backups.yaml Adds Backup fixtures.
velero/​test-files/​README.md Documents fixture usage.
velero/​test-files/​matching-cases.yaml Adds coverage-matching scenarios.
velero/​src/​veleroIcon.ts Registers the Velero icon.
velero/​src/​utils/​veleroRoutes.ts Defines route names and paths.
velero/​src/​utils/​status.ts Maps Velero phases to status colors.
velero/​src/​utils/​backupQuery.ts Builds Backup label selectors.
velero/​src/​utils/​backupQuery.test.ts Tests selector generation.
velero/​src/​storybook.test.tsx Enables story snapshots.
velero/​src/​settings.tsx Adds namespace settings UI.
velero/​src/​resources/​velero.ts Defines Velero resource models.
velero/​src/​index.tsx Registers navigation, routes, and panels.
velero/​src/​hooks/​useVeleroInstalled.ts Detects the Velero API.
velero/​src/​hooks/​useVeleroData.ts Loads and joins Schedule/Backup data.
velero/​src/​headlamp-plugin.d.ts Adds plugin type references.
velero/​src/​cron.ts Parses schedules and calculates next runs.
velero/​src/​cron.test.ts Tests cron utilities.
velero/​src/​coverage.ts Implements coverage matching.
velero/​src/​coverage.test.ts Tests coverage behavior.
velero/​src/​config.ts Defines plugin configuration.
velero/​src/​components/​schedules/​List.tsx Adds the Schedule list.
velero/​src/​components/​schedules/​Detail.tsx Adds Schedule details.
velero/​src/​components/​restores/​List.tsx Adds the Restore list.
velero/​src/​components/​restores/​Detail.tsx Adds Restore details.
velero/​src/​components/​common/​VeleroInstallCheck.tsx Adds installation gating.
velero/​src/​components/​backups/​List.tsx Adds the Backup list.
velero/​src/​components/​backups/​Detail.tsx Adds Backup details.
velero/​src/​components/​BackupCoveragePanelPure.tsx Renders coverage states and results.
velero/​src/​components/​BackupCoveragePanel.tsx Connects resource panels to Velero data.
velero/​src/​components/​BackupCoveragePanel.stories.tsx Adds coverage panel stories.
velero/​README.md Documents the plugin.
velero/​package.json Defines package scripts and dependencies.
velero/​.gitignore Ignores generated artifacts.
README.md Adds Velero to the plugin catalog.

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

Comment thread velero/src/coverage.ts Outdated
Comment thread velero/src/utils/backupQuery.ts Outdated
Comment thread velero/src/hooks/useVeleroData.ts
Comment thread velero/src/index.tsx
Comment thread velero/src/resources/velero.ts
Comment thread README.md Outdated
Comment thread velero/test-files/README.md

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.

Comment thread velero/src/components/backups/List.tsx Outdated
Comment thread velero/src/components/restores/List.tsx Outdated
Comment thread velero/src/components/schedules/List.tsx Outdated
Comment thread velero/src/cron.ts
Comment thread velero/src/resources/velero.ts
@Pragati5-DEBUG

Copy link
Copy Markdown
Contributor Author

Copilot flagged missing Coverage gaps ,that was intentional. Phase 2 for this PR is Schedules / Backups / Restores only (per #939); Coverage gaps are deferred.

@illume
illume requested a balanced review from Copilot October 11, 2026 05:23

@illume illume 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.

Thanks for these changes.

It looks like this PR has git conflicts. Can you please fix them?

How to resolve conflicts

Rebase or merge the latest main into your branch, resolve the conflicts, and push the updated branch.

Can you please have a look at the git commits to see if they meet the contribution guidelines? We use a Linux kernel style of git commits. See the contributing guide for general context, and please see previous git commits with git log for examples.

Commits that need attention
  • velero: Fix CRON_TZ regex for TypeScript target — Only one file changed inside velero/; add a sub-area so it's clear what was touched (e.g. velero: ComponentName: description).
Commit guidelines
  • Use atomic commits focused on a single change.
  • Use the title format <area>: <Description of changes> — description must start with a capital letter.
  • Keep the title under 72 characters (soft requirement).
  • Explain the intention and why the change is needed.
  • Make commit titles meaningful and describe what changed.
  • Do not add code that a later commit rewrites; squash or reorder commits instead.
  • Do not include Fixes #NN in commit messages.

Good examples:

  • ai-assistant: ai-ui: HomeButton: Fix so it navigates to home
  • kueue: Metrics: Add new way to see what is happening

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.

🟡 Changes recommended

Coverage false positives, the missing coverage-gap view, and an unsafe Restore fixture must be addressed.

1 open finding
5 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Honor Velero namespace-scoped resource filters

velero/​src/​coverage.ts:85

The coverage matcher ignores Velero's namespace-scoped resource filters. Schedule.spec.template is a BackupSpec, which also supports includedNamespaceScopedResources and excludedNamespaceScopedResources; for example, a schedule with excludedNamespaceScopedResources: [deployments.apps] is currently reported as covering a Deployment even though Velero excludes it. Model and evaluate those filters before reporting workload or namespace coverage.

Low severity Correct the contradictory expected coverage result

velero/​test-files/​README.md:40

This expected result contradicts the prescribed fixture set: web-label-only-schedule.yaml selects Deployments in default with app: web, exactly matching case-label-web. After running the commands above, this Deployment is covered, so the manual check currently reports a false failure.

🧠 Review effort: Balanced

Comment thread velero/test-files/sample-restores.yaml Outdated
@Pragati5-DEBUG
Pragati5-DEBUG force-pushed the velero/backup-coverage-phase-2 branch from 49bd6f9 to 167caa0 Compare October 11, 2026 05:40
@Pragati5-DEBUG

Copy link
Copy Markdown
Contributor Author

Conflicts on #1326 are resolved (merged latest main), and the CRON_TZ commit title is updated to velero: cron: Fix CRON_TZ regex for TypeScript target. Ready for another look when you have a moment.

@Pragati5-DEBUG
Pragati5-DEBUG requested a review from illume October 11, 2026 06:04
@illume
illume requested a balanced review from Copilot October 11, 2026 08:07

@illume illume 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.

Thanks for this PR.

the PR has a merge-main commit; please rebase against main to keep the history clean.

Why this matters

Merge commits from main make the PR history harder to review. Please rebase your branch on top of the latest main instead, then update the PR with the rebased commits.

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.

🟡 Changes recommended

The advertised Coverage gaps view is absent, and several schedule status and latest-backup states can be reported inaccurately.

4 open findings
1 resolved since last review

🧠 Review effort: Balanced

Comment thread velero/src/components/schedules/Detail.tsx Outdated
Comment thread velero/src/components/schedules/List.tsx Outdated
Comment thread velero/src/coverage.ts
Comment thread velero/src/resources/velero.ts Outdated
@Pragati5-DEBUG
Pragati5-DEBUG force-pushed the velero/backup-coverage-phase-2 branch from 167caa0 to 45b246e Compare October 11, 2026 08:15
@Pragati5-DEBUG

Copy link
Copy Markdown
Contributor Author

Ready for another look when you have a moment

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.

🟡 Changes recommended

Unresolved read-only behavior, coverage matching, scheduling, and namespace-scoping issues can expose unintended actions or misleading backup information.

5 open findings

🧠 Review effort: Balanced

Comment thread velero/src/components/schedules/Detail.tsx
Comment thread velero/src/components/schedules/Detail.tsx Outdated
Comment thread velero/src/coverage.ts Outdated
Comment thread velero/src/coverage.ts Outdated
Comment thread velero/src/coverage.ts

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.

Comment thread velero/src/components/backups/Detail.tsx
Comment thread velero/src/components/restores/Detail.tsx
@illume
illume requested a balanced review from Copilot October 15, 2026 06:08

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.

🔵 Needs a closer look

Namespace filtering and live-query scope need correction and integration validation before human approval.

0 open findings

7 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Scope Backup history requests to the current Schedule

velero/​src/​components/​schedules/​Detail.tsx:19

This page needs the latest Backup only for the route's Schedule, but useVeleroData(namespace) lists every Schedule and requests retained Backup history for all of them. With many schedules or long retention periods, opening one detail page transfers and watches unrelated histories before reducing them client-side. Add an optional schedule-name scope to the hook and pass name here so this page selects only this schedule's Backups, without requiring the full Schedule list to build that selector.

Medium severity Ignore global namespace filtering for Velero resource lists

velero/​src/​components/​schedules/​List.tsx:30

noNamespaceFilter hides the selector but does not disable ResourceListView's default namespace filtering. If default is selected on another page, rows fetched from the configured velero namespace disappear, with no visible control to clear that filter. This affects Schedules, Backups, and Restores. Give all three lists a search-preserving filterFunction that ignores the global namespace selection, since their requests are already scoped by the plugin setting. Verify navigation from a differently filtered page and confirm text search still works.

🧠 Review effort: Balanced

Shared helpers for Schedules/Backups/Restores list and detail views.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Expose restore fields and lastSkipped so Phase 2 views can stay accurate.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Only treat 404 as not installed; join latest Backup per schedule.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Keep next-run and coverage aligned with Velero schedule behavior.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Avoid a false empty UI when discovery fails for other reasons.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Read-only cluster-wide Schedule browsing for Phase 2.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Show phase, trigger source, and namespace scope without edit actions.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Surface restore source, progress, and errors for operators.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Phase 2 navigation entry points; keep plugin setting text accurate.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Support manual demos of Phase 2 list and detail pages.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Describe Schedules/Backups/Restores and update the plugin catalog.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
@Pragati5-DEBUG
Pragati5-DEBUG force-pushed the velero/backup-coverage-phase-2 branch from aad0bc7 to c0fc075 Compare October 17, 2026 05:02
@illume
illume requested a balanced review from Copilot October 17, 2026 09:33

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.

🟡 Changes recommended

Hidden namespace filtering and missing cluster context can hide resources or display and navigate to resources from the wrong cluster.

3 open issues
1 file not reviewed
  • velero/package-lock.json: Generated file

Review effort: Balanced

Comment thread velero/src/components/restores/List.tsx
Comment thread velero/src/components/schedules/List.tsx
Comment thread velero/src/hooks/useVeleroData.ts
Preserve cluster on related-resource links, ignore Headlamp's global
namespace filter on Velero lists while keeping text search, and key
latest-Backup maps by cluster plus schedule name.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>
Preserve cluster on related-resource links, ignore Headlamp's global
namespace filter on Velero lists while keeping text search, and key
latest-Backup maps by cluster plus schedule name.

Signed-off-by: Pragati <Pragati5-DEBUG@users.noreply.github.com>

@illume illume 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.

🎉 thanks!

@illume
illume merged commit d3aecf7 into headlamp-k8s:main Oct 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request velero

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants