Reject restores from backups not in a completed or partially failed phase#9792
Conversation
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: Subhramit Basu <subhramit.bb@live.in>
|
@sseago @Lyndon-Li hey, could I get an approval for the awaiting CI workflows? |
👷 Deploy request for velero pending review.Visit the deploys page to approve it
|
There was a problem hiding this comment.
Pull request overview
This PR tightens restore validation to ensure a Restore cannot start from a Backup that is not yet usable (or is being deleted), addressing the race described in issue #9790.
Changes:
- Add restore validation to only allow source backups in
CompletedorPartiallyFailedphase. - Update restore workflow documentation to describe the new validation requirement.
- Extend restore controller tests with coverage for allowed/disallowed backup phases and adjust some existing tests to set backup phase explicitly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
site/content/docs/main/restore-reference.md |
Documents that restore validation requires the referenced backup to be in a usable phase (Completed/PartiallyFailed). |
pkg/controller/restore_controller.go |
Enforces backup phase validation during restore admission/validation. |
pkg/controller/restore_controller_test.go |
Adds/updates test cases for the new validation logic (but still needs further updates for consistency). |
changelogs/unreleased/9792-subhramit |
Adds an unreleased changelog note for the new restore validation behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: "restorer throwing an error causes the restore to fail", | ||
| location: defaultStorageLocation, | ||
| restore: NewRestore("foo", "bar", "backup-1", "ns-1", "", velerov1api.RestorePhaseNew).Result(), | ||
| backup: defaultBackup().StorageLocation("default").Result(), | ||
| backup: defaultBackup().StorageLocation("default").Phase(velerov1api.BackupPhaseCompleted).Result(), | ||
| restorerError: errors.New("blarg"), |
There was a problem hiding this comment.
Since all the tests are passing, have to verify the merit of copilot's suggestion. Will take a look soon.
There was a problem hiding this comment.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Subhramit Basu <subhramit.bb@live.in>
|
this repo require 2 maintainer approvals :) Need another not me to go in. |
Reject restores from backups not in a completed or partially failed phase.
Fixes #9790
Please indicate you've done the following:
make new-changelog) or comment/kind changelog-not-requiredon this PR.site/content/docs/main.