chlins and github-actions[bot]
0f86521735
Verify extracted item paths stay inside the backup directory
...
archive.GetItemFilePath/GetVersionedItemFilePath joined the group resource,
namespace and name into a path without checking the result against rootDir.
Those components can come from backup contents - the additional items a
RestoreItemAction returns are built from annotations on a backed up object -
so a component containing ".." resolved to an arbitrary file on the Velero
pod, which was then Stat'd, unmarshalled and restored as a Kubernetes object.
Both helpers now return an error when the joined path escapes rootDir, and all
callers handle it. rootDir is empty when building an entry path inside the
backup tarball, so "." is used as the containment base for that relative form.
Signed-off-by: chlins <chlins.zhang@gmail.com >
2026-07-31 06:02:43 +00:00
Xun Jiang
49b670a791
Replace github.com/pkg/errors by github.com/cockroachdb/errors
...
Change errors.Cause to errors.Is, because github.com/cockroachdb/errors
New() function create a error with error stack with depth 1, but
github.com/pkg/errors's New() function create error with no depth.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com >
2026-06-10 15:55:57 +08:00
Adam Zhang
c8bb3af761
implement fine-grained backup filter policies
...
implement backup logic to support backups with
NamespacedFilterPolicies and ClusterScopedFilterPolicy
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-06-08 15:50:05 +08:00
e8fa708933
Add custom action type to volume policies ( #9540 )
...
Run the E2E test on kind / get-go-version (push) Failing after 1m0s
Run the E2E test on kind / build (push) Has been skipped
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / get-go-version (push) Successful in 10s
Main CI / Build (push) Failing after 25s
Close stale issues and PRs / stale (push) Successful in 11s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m34s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 1m3s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 1m3s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 1m13s
* Add custom action type to volume policies
Signed-off-by: Scott Seago <sseago@redhat.com >
* Update internal/resourcepolicies/resource_policies.go
Co-authored-by: Tiger Kaovilai <passawit.kaovilai@gmail.com >
Signed-off-by: Scott Seago <sseago@redhat.com >
* added "custom" to validation list
Signed-off-by: Scott Seago <sseago@redhat.com >
* responding to review comments
Signed-off-by: Scott Seago <sseago@redhat.com >
---------
Signed-off-by: Scott Seago <sseago@redhat.com >
Co-authored-by: Tiger Kaovilai <passawit.kaovilai@gmail.com >
2026-04-07 10:22:38 -07:00
Xun Jiang
3f15e9219f
Remove the skipped item from the resource list when it's skipped by BIA.
...
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com >
2026-02-27 11:37:34 +08:00
Xun Jiang
bcdee1b116
If BIA return updateObj with SkipFromBackupAnnotation, treat it as skip the resource from backup.
...
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com >
2026-02-13 17:42:46 +08:00
Tiger Kaovilai and Claude Opus 4.5
71ddeefcd6
Fix VolumePolicy PVC phase condition filter for unbound PVCs
...
Use typed error approach: Make GetPVForPVC return ErrPVNotFoundForPVC
when PV is not expected to be found (unbound PVC), then use errors.Is
to check for this error type. When a matching policy exists (e.g.,
pvcPhase: [Pending, Lost] with action: skip), apply the action without
error. When no policy matches, return the original error to preserve
default behavior.
Changes:
- Add ErrPVNotFoundForPVC sentinel error to pvc_pv.go
- Update ShouldPerformSnapshot to handle unbound PVCs with policies
- Update ShouldPerformFSBackup to handle unbound PVCs with policies
- Update item_backupper.go to handle Lost PVCs in tracking functions
- Remove checkPVCOnlySkip helper (no longer needed)
- Update tests to reflect new behavior
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com >
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-02-09 01:03:45 -05:00
Scott Seago
dbaa25405d
move podVolumeContext into backupRequest
...
Signed-off-by: Scott Seago <sseago@redhat.com >
2025-12-02 16:38:41 -05:00
lyndon-li and GitHub
d545ad49ba
Merge branch 'main' into main
2025-09-23 11:10:38 +08:00
0xLeo258
1ebe357d18
Add built-in mutex for SynchronizedVSList && Update unit tests
...
Signed-off-by: 0xLeo258 <noixe0312@gmail.com >
2025-09-20 09:13:07 +08:00
0xLeo258
f2a27c3864
fix9247: Protect VolumeSnapshot field
...
Signed-off-by: 0xLeo258 <noixe0312@gmail.com >
2025-09-20 09:13:07 +08:00
0xLeo258
e21b21c19e
fix 9234: Add safe VolumeSnapshotterCache
...
Signed-off-by: 0xLeo258 <noixe0312@gmail.com >
2025-09-18 17:21:25 +08:00
Shubham Pampattiwar and GitHub
0eb1040a0a
Add labels as a criteria for volume policy ( #8713 )
...
Run the E2E test on kind / build (push) Failing after 6m23s
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 38s
Close stale issues and PRs / stale (push) Successful in 9s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m5s
Trivy Nightly Scan / Trivy nightly scan (velero-restore-helper, main) (push) Failing after 55s
* Add labels as a criteria for volume policy
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
add changelog file
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
handle err
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
use labels selector.matches
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
make update
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
remove fetching pvc from volume policy filtering
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
add more ut coverage
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
* minor updates
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
use VolumeFilterData struct in GetMatchAction func
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
update parsePVC func and add more ut
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
lint fix
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
---------
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
2025-02-26 10:02:45 -05:00
Scott Seago
fcfb2fd9ee
Implement parallel ItemBlock processing via backup_controller goroutines
...
Signed-off-by: Scott Seago <sseago@redhat.com >
2025-02-12 12:03:37 -05:00
Matthieu MOREL
cbba3bdde7
chore: enable use-any from revive
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-01-17 07:58:10 +01:00
Scott Seago
015b1e69f6
Make BackedUpItems thread safe
...
Signed-off-by: Scott Seago <sseago@redhat.com >
2024-12-03 15:23:45 -05:00
Scott Seago
9d6f4d2db5
ItemBlock model and phase 1 (single-thread) workflow changes
...
Signed-off-by: Scott Seago <sseago@redhat.com >
2024-09-03 19:04:18 -04:00
Xun Jiang
c4ce6a3382
Expose the VolumeHelper to third-party plugins.
...
Signed-off-by: Xun Jiang <blackpigletbruce@gmail.com >
2024-07-03 11:16:56 +08:00
Xun Jiang
a91d2cb036
Modify the volume helper logic.
...
Signed-off-by: Xun Jiang <blackpigletbruce@gmail.com >
2024-05-23 09:57:21 +08:00
Shubham Pampattiwar
8d2bef2486
Extend Volume Policies feature to support more actions
...
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
fix volume policy action execution
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
remove unused files
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
add changelog file
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
fix CI linter errors
fix linter errors
address pr review comments
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
fix via make update cmd
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
address PR feedback and add tests
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
fix codespell
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
fix ci linter checks
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
remove volsToExclude processing from volume policy logic and add tests
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
fix ci linter issue
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
2024-04-23 12:54:14 -07:00
Xun Jiang
31e140919a
Merge CSI plugin code.
...
Signed-off-by: Xun Jiang <blackpigletbruce@gmail.com >
2024-04-10 14:53:29 +08:00
Wenkai Yin(尹文开)
8d10b68eda
Improve the concurrency for PVBs in different pods
...
Improve the concurrency for PVBs in different pods
Fixes #6676
Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com >
2024-03-29 09:58:50 +08:00
Xun Jiang
efb94ae610
Refactor the native snapshot definition code.
...
Signed-off-by: Xun Jiang <blackpigletbruce@gmail.com >
2024-03-20 15:38:07 +08:00
Shahaf Bahar and Xun Jiang
36d58943cd
Skip pvb creation when pvc excluded
...
Signed-off-by: Shahaf Bahar <sbahar@redhat.com >
2024-02-27 16:30:29 +08:00
Daniel Jiang and GitHub
f2ba625229
Merge pull request #7138 from blackpiglet/6595_volumeinfo_restore
...
Use VolumeInfo to help restore the PV.
2023-12-05 10:19:16 +08:00
Xun Jiang
c77bec73bb
Move VolumesInformation to an independant package.
...
Signed-off-by: Xun Jiang <jxun@vmware.com >
2023-12-04 08:33:37 +08:00
Xun Jiang
ca97248f2a
Use VolumeInfo to help restore the PV.
...
Add VolumeInfo for left PVs during backup.
Signed-off-by: Xun Jiang <jxun@vmware.com >
2023-12-04 08:33:37 +08:00
Daniel Jiang
266ea5d55a
Make sure the PVs skipped by CSI plugin due to settings in backup spec
...
are tracked
Signed-off-by: Daniel Jiang <jiangd@vmware.com >
2023-12-01 14:19:54 +08:00
Xun Jiang/Bruce Jiang and GitHub
f5bbe82e78
Merge pull request #7152 from reasonerjt/track-skipped-SnapshotVolumes-false
...
Track the skipped PV when SnapshotVolumes set as false
2023-11-29 14:46:23 +08:00
Daniel Jiang
b759877f5b
Track the skipped PV when SnapshotVolumes set as false
...
This commit makes sure if a PV is not taken snapshot b/c the flag
SnapshotVolumes is set to false in a backup CR, the PV is also also
tracked as skipped in the tracker.
Signed-off-by: Daniel Jiang <jiangd@vmware.com >
2023-11-28 22:52:17 +08:00
allenxu404
5d1a632be4
Add hook status to backup/restore CR
...
Signed-off-by: allenxu404 <qix2@vmware.com >
2023-11-28 14:47:31 +08:00
Xun Jiang
7f52321772
Generate VolumeInfo.
...
Remove CSI VolumeSnapshot listter and the informer.
Add download the VolumeInfos metadata for backup.
Signed-off-by: Xun Jiang <jxun@vmware.com >
2023-11-22 09:40:38 +08:00
Xun Jiang
908e2c63ba
Check whether the action is a CSI action and whether CSI feature is
...
enabled, before executing the action.
The DeleteItemAction is not checked, because the DIA doesn't have a
method to get the action's plugin name.
This should be OK, because the CSI will check whether the VS and VSC
have a backup name annotation. If the VS and VSC is not handled by
the CSI plugin, then they don't have the annotation.
Signed-off-by: Xun Jiang <jxun@vmware.com >
2023-10-24 16:54:38 +08:00
Lyndon-Li
2e71cffe0e
issue: move plugin depdending podvolume functions to util pkg
...
Signed-off-by: Lyndon-Li <lyonghui@vmware.com >
2023-09-26 16:39:33 +08:00
Xun Jiang/Bruce Jiang and GitHub
1777bbe5b4
Add warning log for snapshot data mover fell backup to Velero native snapshot. ( #6602 )
...
Enlarge throttle of UT case TestThrottle_ShouldOutput to avoid occasional CI
failure due to timeout caused by test environment's CPU speed
Signed-off-by: Xun Jiang <jxun@vmware.com >
2023-08-04 18:09:21 +08:00
Daniel Jiang and GitHub
2548b20db9
Track the skipped PV in a backup and print the summary in backup log ( #6496 )
...
Partially address the requirements in #5834
Signed-off-by: Daniel Jiang <jiangd@vmware.com >
2023-07-20 16:13:48 +08:00
kayrus
e71ee0cc5f
Add support for OpenStack CSI drivers topology keys
...
Signed-off-by: kayrus <kayrus@users.noreply.github.com >
2023-07-05 17:27:24 +02:00
Peter Pan and GitHub
a97d01f7e6
Fix the snapshot log wording to be more accurate ( #6395 )
...
Signed-off-by: Peter Pan <Peter.Pan@daocloud.io >
2023-06-30 08:14:10 +08:00
Xun Jiang
a5c28ad423
Add warning message for volume snapshotter in data mover case.
...
Signed-off-by: Xun Jiang <jxun@vmware.com >
2023-06-12 17:57:01 +08:00
Xun Jiang/Bruce Jiang and GitHub
a8a17d725a
Merge pull request #6194 from blackpiglet/linter_more
...
Enable more linters, and remove mal-functioned milestoned issue action.
2023-04-26 14:12:47 +08:00
Xun Jiang
443f732e51
Enable more linters, and remove mal-functioned milestoned issue action.
...
Signed-off-by: Xun Jiang <blackpiglet@gmail.com >
2023-04-25 23:31:51 +08:00
Xun Jiang
180cc4e31d
Enable linter revive and resolve found errors: part 1
...
Signed-off-by: Xun Jiang <blackpiglet@gmail.com >
2023-04-25 23:15:15 +08:00
1fd28e8a36
Fix usestdlibvars and whitespace linters issues. ( #6162 )
...
Signed-off-by: Xun Jiang <blackpiglet@gmail.com >
Co-authored-by: Xun Jiang <blackpiglet@gmail.com >
2023-04-24 09:10:55 +08:00
Daniel Jiang
95c674b23a
Refine the log message when BIA is skipped
...
The log message should be clarified, otherwise when a user chooses to do
the backup via podvolme there will be confusing logs, but actually it's
just skipping the BIA for CSI plugin.
Signed-off-by: Daniel Jiang <jiangd@vmware.com >
2023-04-02 23:31:19 +08:00
Ming
83f176e4ac
Fix resource policies not work for vSphere plugin
...
Signed-off-by: Ming <mqiu@vmware.com >
2023-03-29 04:14:34 +00:00
Daniel Jiang and GitHub
82358666c8
Merge pull request #6009 from qiuming-best/resource-policies
...
Adjust match resource policies
2023-03-24 10:48:50 +08:00
Ming
a3cef5b0d3
Adjust match resource policies
...
Signed-off-by: Ming <mqiu@vmware.com >
2023-03-23 03:48:26 +00:00
Scott Seago
433d2d5e57
BIA/RIAv2 -- distinguish between New and InProgress operations
...
Signed-off-by: Scott Seago <sseago@redhat.com >
2023-03-21 18:55:59 -04:00
qiuming and GitHub
086dbd344f
Handle backup of volume by resource policies ( #5901 )
...
* Handle backup of volume by resource policies
Signed-off-by: Ming <mqiu@vmware.com >
2023-03-21 14:39:25 +08:00
lyndon and GitHub
81bee240fe
Merge pull request #5982 from qiuming-best/fix-empty-volume-id
...
Fix take snapshot for PV with empty volume ID
2023-03-20 16:33:49 +08:00