a12b373e4c
Support set-based filter label selectors ( #10064 )
...
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
e2e-test-kind.yaml / extract (push) Failing after 12s
Run the E2E test on kind / get-go-version (push) Failing after 13s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / run-e2e-test (push) Skipped
push.yml / extract (push) Successful in 10s
Main CI / get-go-version (push) Successful in 11s
Main CI / Build (push) Failing after 25s
* Support set-based filter label selectors
Use matchLabels/matchExpressions in fine-grained filters.
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
* omit the details of resource policy for cli
The reason to not resolve and display CLI is because it may go
out of sync, we want to avoid display it to mislead users.
We may consider to cpature those information and display it
in later release.
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
---------
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
Co-authored-by: Scott Seago <sseago@redhat.com >
2026-07-24 16:03:51 -04:00
chlins
666d14de32
feat(resourcepolicies): support dataMover parameter in snapshot volume policy action
...
Signed-off-by: chlins <chlins.zhang@gmail.com >
2026-07-15 15:26:23 +08:00
Shubham Pampattiwar
56b6ba6b10
Add image volume type support to volume policies
...
The Kubernetes image volume type (GA in k8s 1.31) was not recognized by
Velero's volume type detection logic, causing volume policies with
volumeTypes condition set to "image" to be silently ignored. This led
to failed fs-backups when defaultVolumesToFsBackup was enabled, since
image volumes have no host path for the node agent to back up.
Add the "image" SupportedVolume constant and detection in
getVolumeTypeFromVolume() so that volume policies can properly match
and skip image volumes.
Fixes velero-io/velero#9977
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com >
2026-07-08 11:36:17 -07:00
Adam Zhang
7529b3df6d
enhance validation for restore resource policy
...
For resource policy in restore, it will reject invalid sections
such as volumePolicies or includeExcludePolicy, to prevent user
from misuse backup side resource policy configmap.
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-06-25 15:29:18 +08:00
Adam Zhang
f8ebd8fa4b
add more test cases
...
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-06-25 15:29:18 +08:00
Adam Zhang
ffbaceeb6d
add resourcePolicy on restore CRD
...
Add resourcePolicy field for restore CRD which is backed by
a configmap that holds ClusterScopedFilterPolicy and
NamespacedFilterPolicies for restore side filtering.
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-06-25 15:29:18 +08:00
chlins
21d67a8622
feat(backup): add global backup volume policies
...
Signed-off-by: chlins <chlins.zhang@gmail.com >
2026-06-25 11:31:08 +08:00
chlins
a191a449fb
feat(resourcepolicies): support PVC volume mode and access mode matching
...
Signed-off-by: chlins <chlins.zhang@gmail.com >
2026-06-15 16:08:38 +08: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
Xun Jiang
e15e0af346
Replace gopkg.in/yaml.v3 by go.yaml.in/yaml/v3
...
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com >
2026-06-10 15:54:17 +08:00
Adam Zhang
ca0506daa8
address review comments
...
improve wording on validation errors for empty resourceFilters
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-06-04 13:24:27 +08:00
Adam Zhang
eb0659f06d
Add validations for ClusterScopedFilterPolicy
...
Added validations for ClusterScopedFilterPolicy to
report errors for various invalid scenarios.
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-06-04 13:24:27 +08:00
Adam Zhang
3d085de99c
Merge rule 8 and 9 validations into main loop
...
Merge validateNoDuplicateNamespacePatterns and validateGlobPatterns
into validateNamespacedFilterPolicies to avoid iterate the policies
multiple times.
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-06-02 13:53:53 +08:00
Adam Zhang
b278d38f7e
Add validations for NamespacedFilterPolicies
...
Add validation rules for NamespacedFilterPolicies to fail fast
for invalid NamespacedFilterPolicies.
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-05-25 11:08:40 +08:00
348f9227aa
Update internal/resourcepolicies/resource_policies.go
...
Co-authored-by: Tiger Kaovilai <passawit.kaovilai@gmail.com >
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-05-22 13:20:53 +08:00
Adam Zhang
b0e72333a0
extend backup resource policy
...
- added ClusterScopedFilterPolicy/NamespacedFilterPolicy
- added run time data structure, ResolvedResourceFilter and ResolvedNamespaceFilter
Signed-off-by: Adam Zhang <adam.zhang@broadcom.com >
2026-05-21 15:36:51 +08:00
Xun Jiang
da3e7cfaaf
Remove Restic code path from PodVolumeRestore.
...
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com >
2026-04-22 14:07:54 +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
80211d77e5
feat: Add VolumePolicy support for PVC Phase conditions to allow skipping Pending PVCs
...
This commit implements VolumePolicy support for PVC Phase conditions, resolving
vmware-tanzu/velero#7233 where backups fail with ''PVC has no volume backing this claim''
for Pending PVCs.
Changes made:
- Extended VolumePolicy API to support PVC phase conditions
- Added pvcPhaseCondition struct with matching logic
- Modified getMatchAction() to evaluate policies for unbound PVCs before returning errors
- Added case to GetMatchAction() to handle PVC-only scenarios (nil PV)
- Added comprehensive unit tests for PVC phase parsing and matching
Users can now skip Pending PVCs through volume policy configuration:
apiVersion: v1
kind: ConfigMap
metadata:
name: volume-policy
namespace: velero
data:
policy.yaml: |
version: v1
volumePolicies:
- conditions:
pvcPhase: [Pending]
action:
type: skip
chore: rename changelog file to match PR #9166
Renamed changelogs/unreleased/7233-claude to changelogs/unreleased/9166-claude
to match the opened PR at https://github.com/vmware-tanzu/velero/pull/9166
docs: Add PVC phase condition support to VolumePolicy documentation
- Added pvcPhase field to YAML template example
- Documented pvcPhase as a supported condition in the list
- Added comprehensive examples for using PVC phase conditions
- Included examples for Pending, Bound, and Lost phases
- Demonstrated combining PVC phase with other conditions
Co-Authored-By: Tiger Kaovilai <kaovilai@users.noreply.github.com >
2025-12-22 10:07:05 +07:00
Xun Jiang
2178d36d14
Change the CreateFileToPod function's OS parameter as the E2E pass-in value.
...
Run the E2E test on kind / build (push) Failing after 9s
Run the E2E test on kind / setup-test-matrix (push) Successful in 2s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Fix GetResourceWithLabel's bug: labels were not applied.
Add workOS for deployment and pod creationg.
Add OS label for select node.
Enlarge the context timeout to 10 minutes. 5 min is not enough for Windows.
Enlarge the Kibishii test context to 15 minutes for Windows.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com >
2025-08-21 09:34:06 +08:00
Daniel Jiang
249d8f581a
Add include/exclude policy to resources policy
...
fixes #8610
This commit extends the resources policy, such that user can define
resource include exclude filters in the policy and reuse it in different backups.
Signed-off-by: Daniel Jiang <daniel.jiang@broadcom.com >
2025-08-05 15:16:59 +08:00
Matthieu MOREL
07ea14962c
fix require-error rule from testifylint
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-06-23 15:39:54 +00:00
Matthieu MOREL and GitHub
c6a420bd3a
chore: define common aliases for k8s packages ( #8672 )
...
Run the E2E test on kind / build (push) Failing after 6m48s
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 35s
Close stale issues and PRs / stale (push) Successful in 8s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m11s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 47s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 49s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 43s
* lchore: define common alias for k8s packages
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
* Update .golangci.yaml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
* Update .golangci.yaml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
* Update .golangci.yaml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
---------
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-04-22 06:14:47 -04:00
Matthieu MOREL and GitHub
6a6a237ba7
Bump golangci-lint from v1.57.2 to v1.64.5 ( #8641 )
...
Run the E2E test on kind / build (push) Failing after 5m43s
Run the E2E test on kind / setup-test-matrix (push) Successful in 2s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
build-image / Build (push) Failing after 8s
Main CI / Build (push) Failing after 33s
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-03-04 13:55:29 +05:30
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
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
074f26539d
Adding Support For VolumeAttributes in Resource Policy ( #8383 )
...
Run the E2E test on kind / build (push) Failing after 10m15s
Run the E2E test on kind / setup-test-matrix (push) Successful in 1m15s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 4m47s
Close stale issues and PRs / stale (push) Failing after 11m58s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 11m40s
Trivy Nightly Scan / Trivy nightly scan (velero-restore-helper, main) (push) Failing after 14m53s
* Adding VolumeAttributes validations in resource policy
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* adding tests
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* adding tests
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* adding tests
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* added changelog
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* changelog
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* design spec
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* lint fixes
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* doc update
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* doc update
Signed-off-by: mayaggar <mayaggar@microsoft.com >
* Update internal/resourcepolicies/volume_resources_validator.go
Co-authored-by: Tiger Kaovilai <passawit.kaovilai@gmail.com >
Signed-off-by: Mayank Aggarwal <mayankagg9722@gmail.com >
* doc name update
Signed-off-by: mayaggar <mayaggar@microsoft.com >
---------
Signed-off-by: mayaggar <mayaggar@microsoft.com >
Signed-off-by: Mayank Aggarwal <mayankagg9722@gmail.com >
Co-authored-by: Tiger Kaovilai <passawit.kaovilai@gmail.com >
2024-11-28 10:17:07 +05:30
Tiger Kaovilai
a5ef9d6f7c
Typo: ebs.csi.aws.com instead of aws.ebs.csi.driver
...
Per driver [code](https://github.com/kubernetes-sigs/aws-ebs-csi-driver/blob/966da33cffbd3813846ff0463b6bf31d6a9d91d1/pkg/driver/driver.go#L49C30-L49C45 )
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com >
2024-11-07 16:24:25 -05:00
Matthieu MOREL and GitHub
c8baaa9b11
testifylint: enable more rules ( #8024 )
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-07-18 10:43:16 -04:00
Matthieu MOREL and GitHub
35c90f1672
testifylint: enable error-nil rule ( #7670 )
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-07-16 12:23:16 -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
Daniel Jiang
bed10c7fe6
Fix the problems found by codespell
...
Signed-off-by: Daniel Jiang <daniel.jiang@broadcom.com >
2024-05-24 13:32:54 +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
Matthieu MOREL
ef04ef6361
golangci-lint: use exclude-rules instead of skip-files and skip-dirs
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-03-27 20:17:34 +00:00
qiuming and GitHub
5ff5073cc3
Add volume types filter in resource policies ( #6863 )
...
Signed-off-by: Ming Qiu <mqiu@vmware.com >
2023-10-16 17:36:54 -04:00
yanggang
11745809c4
Add missing file licences and do some clean works.
...
Signed-off-by: yanggang <gang.yang@daocloud.io >
2023-09-29 04:25:01 +01:00
yanggang
76b6077683
Keep the logs info ns/name is the same with other modules.
...
Signed-off-by: yanggang <gang.yang@daocloud.io >
2023-09-06 18:40:10 +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
Xun Jiang
bbc1e2e151
Enable stylecheck linter and resolve found issues.
...
Signed-off-by: Xun Jiang <blackpiglet@gmail.com >
2023-04-25 14:37:02 +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
Ming
d429d38ea1
Fix csi contidion policy match
...
Signed-off-by: Ming <mqiu@vmware.com >
2023-04-03 06:16:44 +00:00
Ming
a3cef5b0d3
Adjust match resource policies
...
Signed-off-by: Ming <mqiu@vmware.com >
2023-03-23 03:48:26 +00: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