vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.42k stars 1.37k forks source link

Need to make the resource collecter more efficient on the namespace filtering #7706

Open blackpiglet opened 2 months ago

blackpiglet commented 2 months ago

Describe the problem/challenge you have

https://github.com/vmware-tanzu/velero/blob/f04fbbcc41d1e5c5802699c6f1efc964431248f6/pkg/backup/item_collector.go#L295

https://github.com/vmware-tanzu/velero/blob/f04fbbcc41d1e5c5802699c6f1efc964431248f6/pkg/backup/item_collector.go#L438-L459 During item collecting, the resource collecting is inefficient on the namespace filtering.

If the backup's namespace filter has excluded rules, but no include rules, based on the current code, the item collector will collect name-scoped resources in all namespaces. This is inefficient, but not a bug, because the backup process will check the namespace filter again later.

Describe the solution you'd like

It should be more efficient.

Anything else you would like to add:

Environment:

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.