mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 03:35:22 +00:00
Merge branch 'main' of https://github.com/qiuming-best/velero into resource-policies-e2e
This commit is contained in:
2
.github/workflows/pr-codespell.yml
vendored
2
.github/workflows/pr-codespell.yml
vendored
@@ -15,6 +15,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# ignore the config/.../crd.go file as it's generated binary data that is edited elswhere.
|
# ignore the config/.../crd.go file as it's generated binary data that is edited elswhere.
|
||||||
skip: .git,*.png,*.jpg,*.woff,*.ttf,*.gif,*.ico,./config/crd/v1beta1/crds/crds.go,./config/crd/v1/crds/crds.go,./go.sum,./LICENSE
|
skip: .git,*.png,*.jpg,*.woff,*.ttf,*.gif,*.ico,./config/crd/v1beta1/crds/crds.go,./config/crd/v1/crds/crds.go,./go.sum,./LICENSE
|
||||||
ignore_words_list: iam,aks,ist,bridget,ue,shouldnot
|
ignore_words_list: iam,aks,ist,bridget,ue,shouldnot,atleast
|
||||||
check_filenames: true
|
check_filenames: true
|
||||||
check_hidden: true
|
check_hidden: true
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -49,4 +49,6 @@ tilt-resources/deployment.yaml
|
|||||||
tilt-resources/node-agent.yaml
|
tilt-resources/node-agent.yaml
|
||||||
tilt-resources/cloud
|
tilt-resources/cloud
|
||||||
|
|
||||||
|
# test generated files
|
||||||
test/e2e/report.xml
|
test/e2e/report.xml
|
||||||
|
coverage.out
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ The following is a list of the supported Kubernetes versions for each Velero ver
|
|||||||
|
|
||||||
| Velero version | Expected Kubernetes version compatibility | Tested on Kubernetes version |
|
| Velero version | Expected Kubernetes version compatibility | Tested on Kubernetes version |
|
||||||
|----------------|-------------------------------------------|----------------------------------------|
|
|----------------|-------------------------------------------|----------------------------------------|
|
||||||
|
| 1.11 | 1.18-latest | 1.23.10, 1.24.9, 1.25.5, and 1.26.1 |
|
||||||
| 1.10 | 1.18-latest | 1.22.5, 1.23.8, 1.24.6 and 1.25.1 |
|
| 1.10 | 1.18-latest | 1.22.5, 1.23.8, 1.24.6 and 1.25.1 |
|
||||||
| 1.9 | 1.18-latest | 1.20.5, 1.21.2, 1.22.5, 1.23, and 1.24 |
|
| 1.9 | 1.18-latest | 1.20.5, 1.21.2, 1.22.5, 1.23, and 1.24 |
|
||||||
| 1.8 | 1.18-latest | |
|
| 1.8 | 1.18-latest | |
|
||||||
|
|||||||
126
changelogs/CHANGELOG-1.11.md
Normal file
126
changelogs/CHANGELOG-1.11.md
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
## v1.11
|
||||||
|
### 2023-04-07
|
||||||
|
|
||||||
|
### Download
|
||||||
|
https://github.com/vmware-tanzu/velero/releases/tag/v1.11.0
|
||||||
|
|
||||||
|
### Container Image
|
||||||
|
`velero/velero:v1.11.0`
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
https://velero.io/docs/v1.11/
|
||||||
|
|
||||||
|
### Upgrading
|
||||||
|
https://velero.io/docs/v1.11/upgrade-to-1.11/
|
||||||
|
|
||||||
|
### Highlights
|
||||||
|
|
||||||
|
#### BackupItemAction v2
|
||||||
|
This feature implements the BackupItemAction v2. BIA v2 has two new methods: Progress() and Cancel() and modifies the Execute() return value.
|
||||||
|
|
||||||
|
The API change is needed to facilitate long-running BackupItemAction plugin actions that may not be complete when the Execute() method returns. This will allow long-running BackupItemAction plugin actions to continue in the background while the Velero moves to the following plugin or the next item.
|
||||||
|
|
||||||
|
#### RestoreItemAction v2
|
||||||
|
This feature implemented the RestoreItemAction v2. RIA v2 has three new methods: Progress(), Cancel(), and AreAdditionalItemsReady(), and it modifies RestoreItemActionExecuteOutput() structure in the RIA return value.
|
||||||
|
|
||||||
|
The Progress() and Cancel() methods are needed to facilitate long-running RestoreItemAction plugin actions that may not be complete when the Execute() method returns. This will allow long-running RestoreItemAction plugin actions to continue in the background while the Velero moves to the following plugin or the next item. The AreAdditionalItemsReady() method is needed to allow plugins to tell Velero to wait until the returned additional items have been restored and are ready for use in the cluster before restoring the current item.
|
||||||
|
|
||||||
|
#### Plugin Progress Monitoring
|
||||||
|
This is intended as a replacement for the previously-approved Upload Progress Monitoring design ([Upload Progress Monitoring](https://github.com/vmware-tanzu/velero/blob/main/design/upload-progress.md)) to expand the supported use cases beyond snapshot upload to include what was previously called Async Backup/Restore Item Actions.
|
||||||
|
|
||||||
|
#### Flexible resource policy that can filter volumes to skip in the backup
|
||||||
|
This feature provides a flexible policy to filter volumes in the backup without requiring patching any labels or annotations to the pods or volumes. This policy is configured as k8s ConfigMap and maintained by the users themselves, and it can be extended to more scenarios in the future. By now, the policy rules out volumes from backup depending on the CSI driver, NFS setting, volume size, and StorageClass setting. Please refer to [policy API design](https://github.com/vmware-tanzu/velero/blob/main/design/Implemented/handle-backup-of-volumes-by-resources-filters.md#api-design) for the policy's ConifgMap format. It is not guaranteed to work on unofficial third-party plugins as it may not follow the existing backup workflow code logic of Velero.
|
||||||
|
|
||||||
|
#### Resource Filters that can distinguish cluster scope and namespace scope resources
|
||||||
|
This feature adds four new resource filters for backup. The new filters are separated into cluster scope and namespace scope. Before this feature, Velero could not filter cluster scope resources precisely. This feature provides the ability and refactors existing resource filter parameters.
|
||||||
|
|
||||||
|
#### Add a parameter for setting the Velero server connection with the k8s API server's timeout
|
||||||
|
In Velero, some code pieces need to communicate with the k8s API server. Before v1.11, these code pieces used hard-code timeout settings. This feature adds a resource-timeout parameter in the velero server binary to make it configurable.
|
||||||
|
|
||||||
|
#### Add resource list in the output of the restore describe command
|
||||||
|
Before this feature, Velero restore didn't have a restored resources list as the Velero backup. It's not convenient for users to learn what is restored. This feature adds the resources list and the handling result of the resources (including created, updated, failed, and skipped).
|
||||||
|
|
||||||
|
#### Refactor controllers with controller-runtime
|
||||||
|
In v1.11, Backup Controller and Restore controller are refactored with controller-runtime. Till v1.11, all Velero controllers use the controller-runtime framework.
|
||||||
|
|
||||||
|
#### Runtime and dependencies
|
||||||
|
To fix CVEs and keep pace with Golang, Velero made changes as follows:
|
||||||
|
* Bump Golang runtime to v1.19.8.
|
||||||
|
* Bump several dependent libraries to new versions.
|
||||||
|
* Compile Restic (v0.15.0) with Golang v1.19.8 instead of packaging the official binary.
|
||||||
|
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
* The Velero CSI plugin now determines whether to restore Volume's data from snapshots on the restore's restorePVs setting. Before v1.11, the CSI plugin doesn't check the restorePVs parameter setting.
|
||||||
|
|
||||||
|
|
||||||
|
### Limitations/Known issues
|
||||||
|
* The Flexible resource policy that can filter volumes to skip in the backup is not guaranteed to work on unofficial third-party plugins because the plugins may not follow the existing backup workflow code logic of Velero. The ConfigMap used as the policy is supposed to be maintained by users.
|
||||||
|
|
||||||
|
|
||||||
|
### All Changes
|
||||||
|
* Modify new scope resource filters name. (#6089, @blackpiglet)
|
||||||
|
* Make Velero not exits when EnableCSI is on and CSI snapshot not installed (#6062, @blackpiglet)
|
||||||
|
* Restore Services before Clusters (#6057, @ywk253100)
|
||||||
|
* Fixed backup deletion bug related to async operations (#6041, @sseago)
|
||||||
|
* Update Golang version to v1.19 for branch main. (#6039, @blackpiglet)
|
||||||
|
* Fix issue #5972, don't assume errorField as error type when dealing with logger.WithError (#6028, @Lyndon-Li)
|
||||||
|
* distinguish between New and InProgress operations (#6012, @sseago)
|
||||||
|
* Modify golangci.yaml file. Resolve found lint issues. (#6008, @blackpiglet)
|
||||||
|
* Remove Reference of itemsnapshotter (#5997, @reasonerjt)
|
||||||
|
* minor fixes for backup_operations_controller (#5996, @sseago)
|
||||||
|
* RIAv2 async operations controller work (#5993, @sseago)
|
||||||
|
* Follow-on fixes for BIAv2 controller work (#5971, @sseago)
|
||||||
|
* Refactor backup controller based on the controller-runtime framework. (#5969, @qiuming-best)
|
||||||
|
* Fix client wait problem after async operation change, velero backup/restore --wait should check a full list of the terminal status (#5964, @Lyndon-Li)
|
||||||
|
* Fix issue #5935, refactor the logics for backup/restore persistent log, so as to remove the contest to gzip writer (#5956, @Lyndon-Li)
|
||||||
|
* Switch the base image to distroless/base-nossl-debian11 to reduce the CVE triage efforts (#5939, @ywk253100)
|
||||||
|
* Wait for additional items to be ready before restoring current item (#5933, @sseago)
|
||||||
|
* Add configurable server setting for default timeouts (#5926, @eemcmullan)
|
||||||
|
* Add warning/error result to cmd `velero backup describe` (#5916, @allenxu404)
|
||||||
|
* Fix Dependabot alerts. Use 1.18 and 1.19 golang instead of patch image in dockerfile. Add release-1.10 and release-1.9 in Trivy daily scan. (#5911, @blackpiglet)
|
||||||
|
* Update client-go to v0.25.6 (#5907, @kaovilai)
|
||||||
|
* Limit the concurrent number for backup's VolumeSnapshot operation. (#5900, @blackpiglet)
|
||||||
|
* Fix goreleaser issue for resolving tags and updated it's version. (#5899, @anshulahuja98)
|
||||||
|
* This is to fix issue 5881, enhance the PVB tracker in two modes, Track and Taken (#5894, @Lyndon-Li)
|
||||||
|
* Add labels for velero installed namespace to support PSA. (#5873, @blackpiglet)
|
||||||
|
* Add restored resource list in the restore describe command (#5867, @ywk253100)
|
||||||
|
* Add a json output to cmd velero backup describe (#5865, @allenxu404)
|
||||||
|
* Make restore controller adopting the controller-runtime framework. (#5864, @blackpiglet)
|
||||||
|
* Replace k8s.io/apimachinery/pkg/util/clock with k8s.io/utils/clock (#5859, @hezhizhen)
|
||||||
|
* Restore finalizer and managedFields of metadata during the restoration (#5853, @ywk253100)
|
||||||
|
* BIAv2 async operations controller work (#5849, @sseago)
|
||||||
|
* Add secret restore item action to handle service account token secret (#5843, @ywk253100)
|
||||||
|
* Add new resource filters can separate cluster and namespace scope resources. (#5838, @blackpiglet)
|
||||||
|
* Correct PVB/PVR Failed Phase patching during startup (#5828, @kaovilai)
|
||||||
|
* bump up golang net to fix CVE-2022-41721 (#5812, @Lyndon-Li)
|
||||||
|
* Update CRD descriptions for SnapshotVolumes and restorePVs (#5807, @shubham-pampattiwar)
|
||||||
|
* Add mapped selected-node existence check (#5806, @blackpiglet)
|
||||||
|
* Add option "--service-account-name" to install cmd (#5802, @reasonerjt)
|
||||||
|
* Enable staticcheck linter. (#5788, @blackpiglet)
|
||||||
|
* Set Kopia IgnoreUnknownTypes in ErrorHandlingPolicy to True for ignoring backup unknown file type (#5786, @qiuming-best)
|
||||||
|
* Bump up Restic version to 0.15.0 (#5784, @qiuming-best)
|
||||||
|
* Add File system backup related matrics to Grafana dashboard
|
||||||
|
- Add metrics backup_warning_total for record of total warnings
|
||||||
|
- Add metrics backup_last_status for record of last status of the backup (#5779, @allenxu404)
|
||||||
|
* Design for Handling backup of volumes by resources filters (#5773, @qiuming-best)
|
||||||
|
* Add PR container build action, which will not push image. Add GOARM parameter. (#5771, @blackpiglet)
|
||||||
|
* Fix issue 5458, track pod volume backup until the CR is submitted in case it is skipped half way (#5769, @Lyndon-Li)
|
||||||
|
* Fix issue 5226, invalidate the related backup repositories whenever the backup storage info change in BSL (#5768, @Lyndon-Li)
|
||||||
|
* Add Restic builder in Dockerfile, and keep the used built Golang image version in accordance with upstream Restic. (#5764, @blackpiglet)
|
||||||
|
* Fix issue 5043, after the restore pod is scheduled, check if the node-agent pod is running in the same node. (#5760, @Lyndon-Li)
|
||||||
|
* Remove restore controller's redundant client. (#5759, @blackpiglet)
|
||||||
|
* Define itemoperations.json format and update DownloadRequest API (#5752, @sseago)
|
||||||
|
* Add Trivy nightly scan. (#5740, @jxun)
|
||||||
|
* Fix issue 5696, check if the repo is still openable before running the prune and forget operation, if not, try to reconnect the repo (#5715, @Lyndon-Li)
|
||||||
|
* Fix error with Restic backup empty volumes (#5713, @qiuming-best)
|
||||||
|
* new backup and restore phases to support async plugin operations:
|
||||||
|
- WaitingForPluginOperations
|
||||||
|
- WaitingForPluginOperationsPartiallyFailed (#5710, @sseago)
|
||||||
|
* Prevent nil panic on exec restore hooks (#5675, @dymurray)
|
||||||
|
* Fix CVEs scanned by trivy (#5653, @qiuming-best)
|
||||||
|
* Publish backupresults json to enhance error info during backups. (#5576, @anshulahuja98)
|
||||||
|
* RestoreItemAction v2 API implementation (#5569, @sseago)
|
||||||
|
* add new RestoreItemAction of "velero.io/change-image-name" to handle the issue mentioned at #5519 (#5540, @wenterjoy)
|
||||||
|
* BackupItemAction v2 API implementation (#5442, @sseago)
|
||||||
|
* Proposal to separate resource filter into cluster scope and namespace scope (#5333, @blackpiglet)
|
||||||
@@ -1 +0,0 @@
|
|||||||
Proposal to separate resource filter into cluster scope and namespace scope
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
BackupItemAction v2 API implementation
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
add new RestoreItemAction of "velero.io/change-image-name" to handle the issue mentioned at #5519
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
RestoreItemAction v2 API implementation
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Publish backupresults json to enhance error info during backups.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix CVEs scanned by trivy
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Prevent nil panic on exec restore hooks
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
new backup and restore phases to support async plugin operations:
|
|
||||||
- WaitingForPluginOperations
|
|
||||||
- WaitingForPluginOperationsPartiallyFailed
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix error with Restic backup empty volumes
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix issue 5696, check if the repo is still openable before running the prune and forget operation, if not, try to reconnect the repo
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add Trivy nightly scan.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Define itemoperations.json format and update DownloadRequest API
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Remove restore controller's redundant client.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix issue 5043, after the restore pod is scheduled, check if the node-agent pod is running in the same node.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add Restic builder in Dockerfile, and keep the used built Golang image version in accordance with upstream Restic.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix issue 5226, invalidate the related backup repositories whenever the backup storage info change in BSL
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix issue 5458, track pod volume backup until the CR is submitted in case it is skipped half way
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add PR container build action, which will not push image. Add GOARM parameter.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Design for Handling backup of volumes by resources filters
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
Add File system backup related matrics to Grafana dashboard
|
|
||||||
Add metrics backup_warning_total for record of total warnings
|
|
||||||
Add metrics backup_last_status for record of last status of the backup
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Bump up Restic version to 0.15.0
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Set Kopia IgnoreUnknownTypes in ErrorHandlingPolicy to True for ignoring backup unknown file type
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Enable staticcheck linter.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add option "--service-account-name" to install cmd
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add mapped selected-node existence check
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Update CRD descriptions for SnapshotVolumes and restorePVs
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
bump up golang net to fix CVE-2022-41721
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Correct PVB/PVR Failed Phase patching during startup
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add new resource filters can separate cluster and namespace scope resources.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add secret restore item action to handle service account token secret
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
BIAv2 async operations controller work
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Restore finalizer and managedFields of metadata during the restoration
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Replace k8s.io/apimachinery/pkg/util/clock with k8s.io/utils/clock
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Make restore controller adopting the controller-runtime framework.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add a json output to cmd velero backup describe
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add restored resource list in the restore describe command
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add labels for velero installed namespace to support PSA.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
This is to fix issue 5881, enhance the PVB tracker in two modes, Track and Taken
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix goreleaser issue for resolving tags and updated it's version.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Limit the concurrent number for backup's VolumeSnapshot operation.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Update client-go to v0.25.6
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix Dependabot alerts. Use 1.18 and 1.19 golang instead of patch image in dockerfile. Add release-1.10 and release-1.9 in Trivy daily scan.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add warning/error result to cmd `velero backup describe`
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add configurable server setting for default timeouts
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Wait for additional items to be ready before restoring current item
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Switch the base image to distroless/base-nossl-debian11 to reduce the CVE triage efforts
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix issue #5935, refactor the logics for backup/restore persistent log, so as to remove the contest to gzip writer
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix client wait problem after async operation change, velero backup/restore --wait should check a full list of the terminal status
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Refactor backup controller based on the controller-runtime framework.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Follow-on fixes for BIAv2 controller work
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
RIAv2 async operations controller work
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
minor fixes for backup_operations_controller
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Remove Reference of itemsnapshotter
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Modify golangci.yaml file. Resolve found lint issues.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
distinguish between New and InProgress operations
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix issue #5972, don't assume errorField as error type when dealing with logger.WithError
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Update Golang version to v1.19 for branch main.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fixed backup deletion bug related to async operations
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Restore Services before Clusters
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Make Velero not exits when EnableCSI is on and CSI snapshot not installed
|
|
||||||
@@ -54,18 +54,20 @@ spec:
|
|||||||
Use DefaultVolumesToFsBackup instead."
|
Use DefaultVolumesToFsBackup instead."
|
||||||
nullable: true
|
nullable: true
|
||||||
type: boolean
|
type: boolean
|
||||||
excludedClusterScopeResources:
|
excludedClusterScopedResources:
|
||||||
description: ExcludedClusterScopeResources is a slice of cluster scope
|
description: ExcludedClusterScopedResources is a slice of cluster-scoped
|
||||||
resource type names to exclude from the backup. If set to "*", all
|
resource type names to exclude from the backup. If set to "*", all
|
||||||
cluster scope resource types are excluded.
|
cluster-scoped resource types are excluded. The default value is
|
||||||
|
empty.
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
type: array
|
type: array
|
||||||
excludedNamespacedResources:
|
excludedNamespaceScopedResources:
|
||||||
description: ExcludedNamespacedResources is a slice of namespace scope
|
description: ExcludedNamespaceScopedResources is a slice of namespace-scoped
|
||||||
resource type names to exclude from the backup. If set to "*", all
|
resource type names to exclude from the backup. If set to "*", all
|
||||||
namespace scope resource types are excluded.
|
namespace-scoped resource types are excluded. The default value
|
||||||
|
is empty.
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
@@ -275,17 +277,17 @@ spec:
|
|||||||
resources should be included for consideration in the backup.
|
resources should be included for consideration in the backup.
|
||||||
nullable: true
|
nullable: true
|
||||||
type: boolean
|
type: boolean
|
||||||
includedClusterScopeResources:
|
includedClusterScopedResources:
|
||||||
description: IncludedClusterScopeResources is a slice of cluster scope
|
description: IncludedClusterScopedResources is a slice of cluster-scoped
|
||||||
resource type names to include in the backup. If set to "*", all
|
resource type names to include in the backup. If set to "*", all
|
||||||
cluster scope resource types are included. The default value is
|
cluster-scoped resource types are included. The default value is
|
||||||
empty, which means only related cluster scope resources are included.
|
empty, which means only related cluster-scoped resources are included.
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
type: array
|
type: array
|
||||||
includedNamespacedResources:
|
includedNamespaceScopedResources:
|
||||||
description: IncludedNamespacedResources is a slice of namespace scope
|
description: IncludedNamespaceScopedResources is a slice of namespace-scoped
|
||||||
resource type names to include in the backup. The default value
|
resource type names to include in the backup. The default value
|
||||||
is "*".
|
is "*".
|
||||||
items:
|
items:
|
||||||
|
|||||||
@@ -84,18 +84,20 @@ spec:
|
|||||||
entirely in future. Use DefaultVolumesToFsBackup instead."
|
entirely in future. Use DefaultVolumesToFsBackup instead."
|
||||||
nullable: true
|
nullable: true
|
||||||
type: boolean
|
type: boolean
|
||||||
excludedClusterScopeResources:
|
excludedClusterScopedResources:
|
||||||
description: ExcludedClusterScopeResources is a slice of cluster
|
description: ExcludedClusterScopedResources is a slice of cluster-scoped
|
||||||
scope resource type names to exclude from the backup. If set
|
resource type names to exclude from the backup. If set to "*",
|
||||||
to "*", all cluster scope resource types are excluded.
|
all cluster-scoped resource types are excluded. The default
|
||||||
|
value is empty.
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
type: array
|
type: array
|
||||||
excludedNamespacedResources:
|
excludedNamespaceScopedResources:
|
||||||
description: ExcludedNamespacedResources is a slice of namespace
|
description: ExcludedNamespaceScopedResources is a slice of namespace-scoped
|
||||||
scope resource type names to exclude from the backup. If set
|
resource type names to exclude from the backup. If set to "*",
|
||||||
to "*", all namespace scope resource types are excluded.
|
all namespace-scoped resource types are excluded. The default
|
||||||
|
value is empty.
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
@@ -310,20 +312,20 @@ spec:
|
|||||||
resources should be included for consideration in the backup.
|
resources should be included for consideration in the backup.
|
||||||
nullable: true
|
nullable: true
|
||||||
type: boolean
|
type: boolean
|
||||||
includedClusterScopeResources:
|
includedClusterScopedResources:
|
||||||
description: IncludedClusterScopeResources is a slice of cluster
|
description: IncludedClusterScopedResources is a slice of cluster-scoped
|
||||||
scope resource type names to include in the backup. If set to
|
resource type names to include in the backup. If set to "*",
|
||||||
"*", all cluster scope resource types are included. The default
|
all cluster-scoped resource types are included. The default
|
||||||
value is empty, which means only related cluster scope resources
|
value is empty, which means only related cluster-scoped resources
|
||||||
are included.
|
are included.
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
type: array
|
type: array
|
||||||
includedNamespacedResources:
|
includedNamespaceScopedResources:
|
||||||
description: IncludedNamespacedResources is a slice of namespace
|
description: IncludedNamespaceScopedResources is a slice of namespace-scoped
|
||||||
scope resource type names to include in the backup. The default
|
resource type names to include in the backup. The default value
|
||||||
value is "*".
|
is "*".
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
402
design/Implemented/cluster-scope-resource-filter.md
Normal file
402
design/Implemented/cluster-scope-resource-filter.md
Normal file
@@ -0,0 +1,402 @@
|
|||||||
|
# Proposal to add resource filters for backup can distinguish whether resource is cluster-scoped or namespace-scoped.
|
||||||
|
|
||||||
|
- [Proposal to add resource filters for backup can distinguish whether resource is cluster-scoped or namespace-scoped.](#proposal-to-add-resource-filters-for-backup-can-distinguish-whether-resource-is-cluster-scoped-or-namespace-scoped)
|
||||||
|
- [Abstract](#abstract)
|
||||||
|
- [Background](#background)
|
||||||
|
- [Goals](#goals)
|
||||||
|
- [Non Goals](#non-goals)
|
||||||
|
- [High-Level Design](#high-level-design)
|
||||||
|
- [Parameters Rules](#parameters-rules)
|
||||||
|
- [Using scenarios:](#using-scenarios)
|
||||||
|
- [no namespace-scoped resources + some cluster-scoped resources](#no-namespace-scoped-resources--some-cluster-scoped-resources)
|
||||||
|
- [no namespace-scoped resources + all cluster-scoped resources](#no-namespace-scoped-resources--all-cluster-scoped-resources)
|
||||||
|
- [some namespace-scoped resources + no cluster-scoped resources](#some-namespace-scoped-resources--no-cluster-scoped-resources)
|
||||||
|
- [scenario 1](#scenario-1)
|
||||||
|
- [scenario 2](#scenario-2)
|
||||||
|
- [scenario 3](#scenario-3)
|
||||||
|
- [scenario 4](#scenario-4)
|
||||||
|
- [some namespace-scoped resources + only related cluster-scoped resources](#some-namespace-scoped-resources--only-related-cluster-scoped-resources)
|
||||||
|
- [scenario 1](#scenario-1-1)
|
||||||
|
- [scenario 2](#scenario-2-1)
|
||||||
|
- [scenario 3](#scenario-3-1)
|
||||||
|
- [some namespace-scoped resources + some additional cluster-scoped resources](#some-namespace-scoped-resources--some-additional-cluster-scoped-resources)
|
||||||
|
- [scenario 1](#scenario-1-2)
|
||||||
|
- [scenario 2](#scenario-2-2)
|
||||||
|
- [scenario 3](#scenario-3-2)
|
||||||
|
- [scenario 4](#scenario-4-1)
|
||||||
|
- [some namespace-scoped resources + all cluster-scoped resources](#some-namespace-scoped-resources--all-cluster-scoped-resources)
|
||||||
|
- [scenario 1](#scenario-1-3)
|
||||||
|
- [scenario 2](#scenario-2-3)
|
||||||
|
- [scenario 3](#scenario-3-3)
|
||||||
|
- [all namespace-scoped resources + no cluster-scoped resources](#all-namespace-scoped-resources--no-cluster-scoped-resources)
|
||||||
|
- [all namespace-scoped resources + some additional cluster-scoped resources](#all-namespace-scoped-resources--some-additional-cluster-scoped-resources)
|
||||||
|
- [all namespace-scoped resources + all cluster-scoped resources](#all-namespace-scoped-resources--all-cluster-scoped-resources)
|
||||||
|
- [describe command change](#describe-command-change)
|
||||||
|
- [Detailed Design](#detailed-design)
|
||||||
|
- [Alternatives Considered](#alternatives-considered)
|
||||||
|
- [Security Considerations](#security-considerations)
|
||||||
|
- [Compatibility](#compatibility)
|
||||||
|
- [Implementation](#implementation)
|
||||||
|
- [Open Issues](#open-issues)
|
||||||
|
|
||||||
|
## Abstract
|
||||||
|
The current filter (IncludedResources/ExcludedResources + IncludeClusterResources flag) is not enough for some special cases, e.g. all namespace-scoped resources + some kind of cluster-scoped resource and all namespace-scoped resources + cluster-scoped resource excludes.
|
||||||
|
Propose to add a new group of resource filtering parameters, which can distinguish cluster-scoped and namespace-scoped resources.
|
||||||
|
|
||||||
|
## Background
|
||||||
|
There are two sets of resource filters for Velero: `IncludedNamespaces/ExcludedNamespaces` and `IncludedResources/ExcludedResources`.
|
||||||
|
`IncludedResources` means only including the resource types specified in the parameter. Both cluster-scoped and namespace-scoped resources are handled in this parameter by now.
|
||||||
|
The k8s resources are separated into cluster-scoped and namespace-scoped.
|
||||||
|
As a result, it's hard to include all resources in one group and only including specified resource in the other group.
|
||||||
|
|
||||||
|
## Goals
|
||||||
|
- Make Velero can support more complicated namespace-scoped and cluster-scoped resources filtering scenarios in backup.
|
||||||
|
|
||||||
|
## Non Goals
|
||||||
|
- Enrich the resource filtering rules, for example, advanced PV filtering and filtering by resource names.
|
||||||
|
|
||||||
|
|
||||||
|
## High-Level Design
|
||||||
|
Four new parameters are added into command `velero backup create`: `--include-cluster-scoped-resources`, `--exclude-cluster-scoped-resources`, `--include-namespace-scoped-resources` and `--exclude-namespace-scoped-resources`.
|
||||||
|
`--include-cluster-scoped-resources` and `--exclude-cluster-scoped-resources` are used to filter cluster-scoped resources included or excluded in backup per resource type.
|
||||||
|
`--include-namespace-scoped-resources` and `--exclude-namespace-scoped-resources` are used to filter namespace-scoped resources included or excluded in backup per resource type.
|
||||||
|
Restore and other code pieces also use resource filtering will be handled in future releases.
|
||||||
|
|
||||||
|
### Parameters Rules
|
||||||
|
|
||||||
|
* `--include-cluster-scoped-resources`, `--include-namespace-scoped-resources`, `--exclude-cluster-scoped-resources` and `--exclude-namespace-scoped-resources` valid value include `*` and comma separated string. Each element of the CSV string should a k8s resource name. The format should be `resource.group`, such as `storageclasses.storage.k8s.io.`.
|
||||||
|
|
||||||
|
* `--include-cluster-scoped-resources`, `--include-namespace-scoped-resources`, `--exclude-cluster-scoped-resources` and `--exclude-namespace-scoped-resources` parameters are mutual exclusive with `--include-cluster-resources`, `--include-resources` and `--exclude-resources` parameters. If both sets of parameters are provisioned, validation failure should be returned.
|
||||||
|
|
||||||
|
* `--include-cluster-scoped-resources` and `--exclude-cluster-scoped-resources` should only contain cluster-scoped resource type names. If namespace-scoped resource type names are included, they are ignored.
|
||||||
|
|
||||||
|
* If there are conflicts between `--include-cluster-scoped-resources` and `--exclude-cluster-scoped-resources` specified resources type lists, `--exclude-cluster-scoped-resources` parameter has higher priority.
|
||||||
|
|
||||||
|
* `--include-namespace-scoped-resources` and `--exclude-namespace-scoped-resources` should only contain namespace-scoped resource type names. If cluster-scoped resource type names are included, they are ignored.
|
||||||
|
|
||||||
|
* If there are conflicts between `--include-namespace-scoped-resources` and `--exclude-namespace-scoped-resources` specified resources type lists, `--exclude-namespace-scoped-resources` parameter has higher priority.
|
||||||
|
|
||||||
|
* If `--include-namespace-scoped-resources` is not present, it means all namespace-scoped resources are included per resource type.
|
||||||
|
|
||||||
|
* If both `--include-cluster-scoped-resources` and `--exclude-cluster-scoped-resources` are not present, it means no additional cluster-scoped resource is included per resource type, just as the existing `--include-cluster-resources` parameter not setting value. Cluster-scoped resources are related to the namespace-scoped resources, which means those are returned in the namespace-scoped resources' BackupItemAction's result AdditionalItems array, are still included in backup by default. Taking backing up PVC scenario as an example, PVC is namespace-scoped, PV is cluster-scoped. PVC's BIA will include PVC related PV into backup too.
|
||||||
|
|
||||||
|
### Using scenarios:
|
||||||
|
Please notice, if the scenario give the example of using old filtering parameters (`--include-cluster-resources`, `--include-resources` and `--exclude-resources`), that means the old parameters also work for this case. If old parameters example is not given, that means they don't work for this scenario, only new parameters (`--include-cluster-scoped-resources`, `--include-namespace-scoped-resources`, `--exclude-cluster-scoped-resources` and `--exclude-namespace-scoped-resources`) work.
|
||||||
|
|
||||||
|
#### no namespace-scoped resources + some cluster-scoped resources
|
||||||
|
The following command means backup no namespace-scoped resources and some cluster-scoped resources.
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--exclude-namespace-scoped-resources=*
|
||||||
|
--include-cluster-scoped-resources=storageclass
|
||||||
|
```
|
||||||
|
|
||||||
|
#### no namespace-scoped resources + all cluster-scoped resources
|
||||||
|
The following command means backup no namespace-scoped resources and all cluster-scoped resources.
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--exclude-namespace-scoped-resources=*
|
||||||
|
--include-cluster-scoped-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
#### some namespace-scoped resources + no cluster-scoped resources
|
||||||
|
##### scenario 1
|
||||||
|
The following commands mean backup all resources in namespaces default and kube-system, and no cluster-scoped resources.
|
||||||
|
|
||||||
|
Example of new parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--exclude-cluster-scoped-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of old parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-cluster-resources=false
|
||||||
|
```
|
||||||
|
##### scenario 2
|
||||||
|
The following commands mean backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in all namespaces, and no cluster-scoped resources. Although PVC's related PV should be included, due to no cluster-scoped resources are included, so they are ruled out too.
|
||||||
|
|
||||||
|
Example of new parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespace-scoped-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
||||||
|
--exclude-cluster-scope-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of old parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
||||||
|
--include-cluster-resources=false
|
||||||
|
```
|
||||||
|
##### scenario 3
|
||||||
|
The following commands mean backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in namespace default and kube-system, and no cluster-scoped resources. Although PVC's related PV should be included, due to no cluster-scoped resources are included, so they are ruled out too.
|
||||||
|
|
||||||
|
Example of new parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-namespace-scoped-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
||||||
|
--exclude-cluster-scope-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of old parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
||||||
|
--include-cluster-resources=false
|
||||||
|
```
|
||||||
|
##### scenario 4
|
||||||
|
The following commands mean backup all resources except Ingress type resources in all namespaces, and no cluster-scoped resources.
|
||||||
|
|
||||||
|
Example of new parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--exclude-namespace-scoped-resources=ingress
|
||||||
|
--exclude-cluster-scoped-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of old parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--exclude-resources=ingress
|
||||||
|
--include-cluster-resources=false
|
||||||
|
```
|
||||||
|
|
||||||
|
#### some namespace-scoped resources + only related cluster-scoped resources
|
||||||
|
##### scenario 1
|
||||||
|
This means backup all resources in namespaces default and kube-system, and related cluster-scoped resources.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
```
|
||||||
|
|
||||||
|
##### scenario 2
|
||||||
|
This means backup pods and configmaps in namespaces default and kube-system, and related cluster-scoped resources.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-namespace-scoped-resources=pods,configmaps
|
||||||
|
```
|
||||||
|
|
||||||
|
##### scenario 3
|
||||||
|
This means backup all resources except Ingress type resources in all namespaces, and related cluster-scoped resources.
|
||||||
|
|
||||||
|
Example of new parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--exclude-namespace-scoped-resources=ingress
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of old parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--exclude-resources=ingress
|
||||||
|
```
|
||||||
|
|
||||||
|
#### some namespace-scoped resources + some additional cluster-scoped resources
|
||||||
|
##### scenario 1
|
||||||
|
This means backup all resources in namespace in default, kube-system, and related cluster-scoped resources, plus all StorageClass resources.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-cluster-scoped-resources=storageclass
|
||||||
|
```
|
||||||
|
|
||||||
|
##### scenario 2
|
||||||
|
This means backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in all namespaces, and related cluster-scoped resources, plus all StorageClass resources, and PVC related PV.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespace-scoped-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
||||||
|
--include-cluster-scoped-resources=storageclass
|
||||||
|
```
|
||||||
|
|
||||||
|
##### scenario 3
|
||||||
|
This means backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in default and kube-system namespaces, and related cluster-scoped resources, plus all StorageClass resources, and PVC related PV.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespace-scoped-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-cluster-scoped-resources=storageclass
|
||||||
|
```
|
||||||
|
|
||||||
|
##### scenario 4
|
||||||
|
This means backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in default and kube-system namespaces, and related cluster-scoped resources, plus all cluster-scoped resources except StorageClass type resources.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespace-scoped-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--exclude-cluster-scoped-resources=storageclass
|
||||||
|
```
|
||||||
|
|
||||||
|
#### some namespace-scoped resources + all cluster-scoped resources
|
||||||
|
##### scenario 1
|
||||||
|
The following commands mean backup all resources in namespace in default, kube-system, and all cluster-scoped resources.
|
||||||
|
|
||||||
|
Example of new parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-cluster-scoped-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of old parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-cluster-resources=true
|
||||||
|
```
|
||||||
|
|
||||||
|
##### scenario 2
|
||||||
|
This means backup Deployment, Service, Endpoint, Pod and ReplicaSet resources in all namespaces, and all cluster-scoped resources.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespace-scoped-resources=deployment,service,endpoint,pod,replicaset
|
||||||
|
--include-cluster-scoped-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
##### scenario 3
|
||||||
|
This means backup Deployment, Service, Endpoint, Pod and ReplicaSet resources in default and kube-system namespaces, and all cluster-scoped resources.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=default,kube-system
|
||||||
|
--include-namespace-scoped-resources=deployment,service,endpoint,pod,replicaset
|
||||||
|
--include-cluster-scoped-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
#### all namespace-scoped resources + no cluster-scoped resources
|
||||||
|
The following commands all mean backup all namespace-scoped resources and no cluster-scoped resources.
|
||||||
|
|
||||||
|
Example of new parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--exclude-cluster-scoped-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
Example of old parameters:
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-cluster-resources=false
|
||||||
|
```
|
||||||
|
|
||||||
|
#### all namespace-scoped resources + some additional cluster-scoped resources
|
||||||
|
This command means backup all namespace-scoped resources, and related cluster-scoped resources, plus all PersistentVolume resources.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-namespaces=*
|
||||||
|
--include-cluster-scoped-resources=persistentvolume
|
||||||
|
```
|
||||||
|
|
||||||
|
#### all namespace-scoped resources + all cluster-scoped resources
|
||||||
|
The following commands have the same meaning: backup all namespace-scoped resources, and all cluster-scoped resources.
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-cluster-scoped-resources=*
|
||||||
|
```
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
velero backup create <backup-name>
|
||||||
|
--include-cluster-resources=true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### describe command change
|
||||||
|
In `velero backup describe` command, the four new parameters should be outputted too.
|
||||||
|
``` bash
|
||||||
|
velero backup describe <backup-name>
|
||||||
|
......
|
||||||
|
|
||||||
|
Namespaces:
|
||||||
|
Included: ns2
|
||||||
|
Excluded: <none>
|
||||||
|
|
||||||
|
Resources:
|
||||||
|
Included cluster-scoped: StorageClass,PersistentVolume
|
||||||
|
Excluded cluster-scoped: <none>
|
||||||
|
Included namespace-scoped: default
|
||||||
|
Excluded namespace-scoped: <none>
|
||||||
|
......
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** `velero restore` command doesn't support those four new parameter in Velero v1.11, but `velero schedule` supports the four new parameters through backup specification.
|
||||||
|
|
||||||
|
## Detailed Design
|
||||||
|
With adding `IncludedNamespaceScopedResources`, `ExcludedNamespaceScopedResources`, `IncludedClusterScopedResources` and `ExcludedClusterScopedResources`, the `BackupSpec` looks like:
|
||||||
|
``` go
|
||||||
|
type BackupSpec struct {
|
||||||
|
......
|
||||||
|
// IncludedResources is a slice of resource names to include
|
||||||
|
// in the backup. If empty, all resources are included.
|
||||||
|
// +optional
|
||||||
|
// +nullable
|
||||||
|
IncludedResources []string `json:"includedResources,omitempty"`
|
||||||
|
|
||||||
|
// ExcludedResources is a slice of resource names that are not
|
||||||
|
// included in the backup.
|
||||||
|
// +optional
|
||||||
|
// +nullable
|
||||||
|
ExcludedResources []string `json:"excludedResources,omitempty"`
|
||||||
|
|
||||||
|
// IncludeClusterResources specifies whether cluster-scoped resources
|
||||||
|
// should be included for consideration in the backup.
|
||||||
|
// +optional
|
||||||
|
// +nullable
|
||||||
|
IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
|
||||||
|
|
||||||
|
// IncludedClusterScopedResources is a slice of cluster-scoped
|
||||||
|
// resource type names to include in the backup.
|
||||||
|
// If set to "*", all cluster scope resource types are included.
|
||||||
|
// The default value is empty, which means only related cluster
|
||||||
|
// scope resources are included.
|
||||||
|
// +optional
|
||||||
|
// +nullable
|
||||||
|
IncludedClusterScopedResources []string `json:"includedClusterScopedResources,omitempty"`
|
||||||
|
|
||||||
|
// ExcludedClusterScopedResources is a slice of cluster-scoped
|
||||||
|
// resource type names to exclude from the backup.
|
||||||
|
// If set to "*", all cluster scope resource types are excluded.
|
||||||
|
// +optional
|
||||||
|
// +nullable
|
||||||
|
ExcludedClusterScopedResources []string `json:"excludedClusterScopedResources,omitempty"`
|
||||||
|
|
||||||
|
// IncludedNamespaceScopedResources is a slice of namespace-scoped
|
||||||
|
// resource type names to include in the backup.
|
||||||
|
// The default value is "*".
|
||||||
|
// +optional
|
||||||
|
// +nullable
|
||||||
|
IncludedNamespaceScopedResources []string `json:"includedNamespaceScopedResources,omitempty"`
|
||||||
|
|
||||||
|
// ExcludedNamespaceScopedResources is a slice of namespace-scoped
|
||||||
|
// resource type names to exclude from the backup.
|
||||||
|
// If set to "*", all namespace scope resource types are excluded.
|
||||||
|
// +optional
|
||||||
|
// +nullable
|
||||||
|
ExcludedNamespaceScopedResources []string `json:"excludedNamespaceScopedResources,omitempty"`
|
||||||
|
......
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Alternatives Considered
|
||||||
|
Proposal from Jibu Data [Issue 5120](https://github.com/vmware-tanzu/velero/issues/5120#issue-1304534563)
|
||||||
|
|
||||||
|
## Security Considerations
|
||||||
|
No security impact.
|
||||||
|
|
||||||
|
## Compatibility
|
||||||
|
The four new parameters cannot be mixed with existing resource filter parameters: `IncludedResources`, `ExcludedResources` and `IncludeClusterResources`.
|
||||||
|
If the new parameters and old parameters both appears in command line, or are specified in backup spec, the command line and the backup should fail.
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
This change should be included into Velero v1.11.
|
||||||
|
New parameters will coexist with `IncludedResources`, `ExcludedResources` and `IncludeClusterResources`.
|
||||||
|
Plan to deprecate `IncludedResources`, `ExcludedResources` and `IncludeClusterResources` in future releases, but also open to the community's feedback.
|
||||||
|
|
||||||
|
## Open Issues
|
||||||
|
`LabelSelector/OrLabelSelectors` apply to namespace-scoped resources.
|
||||||
|
It may be reasonable to make them also working on cluster-scoped resources.
|
||||||
|
An issue is created to trace this topic [resource label selector not work for cluster-scoped resources](https://github.com/vmware-tanzu/velero/issues/5787)
|
||||||
@@ -1,406 +0,0 @@
|
|||||||
# Proposal to add resource filters for backup can distinguish whether resource is cluster scope or namespace scope.
|
|
||||||
|
|
||||||
- [Proposal to add resource filters for backup can distinguish whether resource is cluster scope or namespace scope.](#proposal-to-add-resource-filters-for-backup-can-distinguish-whether-resource-is-cluster-scope-or-namespace-scope)
|
|
||||||
- [Abstract](#abstract)
|
|
||||||
- [Background](#background)
|
|
||||||
- [Goals](#goals)
|
|
||||||
- [Non Goals](#non-goals)
|
|
||||||
- [High-Level Design](#high-level-design)
|
|
||||||
- [Parameters Rules](#parameters-rules)
|
|
||||||
- [Using scenarios:](#using-scenarios)
|
|
||||||
- [no namespaced resources + some cluster resources](#no-namespaced-resources--some-cluster-resources)
|
|
||||||
- [no namespaced resources + all cluster resources](#no-namespaced-resources--all-cluster-resources)
|
|
||||||
- [some namespaced resources + no cluster resources](#some-namespaced-resources--no-cluster-resources)
|
|
||||||
- [scenario 1](#scenario-1)
|
|
||||||
- [scenario 2](#scenario-2)
|
|
||||||
- [scenario 3](#scenario-3)
|
|
||||||
- [scenario 4](#scenario-4)
|
|
||||||
- [some namespaced resources + only related cluster resources](#some-namespaced-resources--only-related-cluster-resources)
|
|
||||||
- [scenario 1](#scenario-1-1)
|
|
||||||
- [scenario 2](#scenario-2-1)
|
|
||||||
- [scenario 3](#scenario-3-1)
|
|
||||||
- [some namespaced resources + some additional cluster resources](#some-namespaced-resources--some-additional-cluster-resources)
|
|
||||||
- [scenario 1](#scenario-1-2)
|
|
||||||
- [scenario 2](#scenario-2-2)
|
|
||||||
- [scenario 3](#scenario-3-2)
|
|
||||||
- [scenario 4](#scenario-4-1)
|
|
||||||
- [some namespaced resources + all cluster resources](#some-namespaced-resources--all-cluster-resources)
|
|
||||||
- [scenario 1](#scenario-1-3)
|
|
||||||
- [scenario 2](#scenario-2-3)
|
|
||||||
- [scenario 3](#scenario-3-3)
|
|
||||||
- [all namespaced resources + no cluster resources](#all-namespaced-resources--no-cluster-resources)
|
|
||||||
- [all namespaced resources + some additional cluster resources](#all-namespaced-resources--some-additional-cluster-resources)
|
|
||||||
- [all namespaced resources + all cluster resources](#all-namespaced-resources--all-cluster-resources)
|
|
||||||
- [describe command change](#describe-command-change)
|
|
||||||
- [Detailed Design](#detailed-design)
|
|
||||||
- [Alternatives Considered](#alternatives-considered)
|
|
||||||
- [Security Considerations](#security-considerations)
|
|
||||||
- [Compatibility](#compatibility)
|
|
||||||
- [Implementation](#implementation)
|
|
||||||
- [Open Issues](#open-issues)
|
|
||||||
|
|
||||||
## Abstract
|
|
||||||
The current filter (IncludedResources/ExcludedResources + IncludeClusterResources flag) is not enough for some special cases, e.g. all namespaced resources + some kind of cluster resource and all namespaced resources + cluster resource excludes.
|
|
||||||
Propose to add a new group of resource filtering parameters, which can distinguish cluster and namespaced resources.
|
|
||||||
|
|
||||||
## Background
|
|
||||||
There are two sets of resource filters for Velero: `IncludedNamespaces/ExcludedNamespaces` and `IncludedResources/ExcludedResources`.
|
|
||||||
`IncludedResources` means only including the resource types specified in the parameter. Both cluster and namespaced resources are handled in this parameter by now.
|
|
||||||
The k8s resources are separated into cluster scope and namespaced scope.
|
|
||||||
As a result, it's hard to include all resources in one group and only including specified resource in the other group.
|
|
||||||
|
|
||||||
## Goals
|
|
||||||
- Make Velero can support more complicated namespaced and cluster resources filtering scenarios in backup.
|
|
||||||
|
|
||||||
## Non Goals
|
|
||||||
- Enrich the resource filtering rules, for example, advanced PV filtering and filtering by resource names.
|
|
||||||
|
|
||||||
|
|
||||||
## High-Level Design
|
|
||||||
Four new parameters are added into command `velero backup create`: `--include-cluster-scope-resources`, `--exclude-cluster-scope-resources`, `--include-namespaced-resources` and `--exclude-namespaced-resources`.
|
|
||||||
`--include-cluster-scope-resources` and `--exclude-cluster-scope-resources` are used to filter cluster scope resources included or excluded in backup per resource type.
|
|
||||||
`--include-namespaced-resources` and `--exclude-namespaced-resources` are used to filter namespace scope resources included or excluded in backup per resource type.
|
|
||||||
Restore and other code pieces also use resource filtering will be handled in future releases.
|
|
||||||
|
|
||||||
### Parameters Rules
|
|
||||||
|
|
||||||
* `--include-cluster-scope-resources`, `--include-namespaced-resources`, `--exclude-cluster-scope-resources` and `--exclude-namespaced-resources` valid value include `*` and comma separated string. Each element of the CSV string should a k8s resource name. The format should be `resource.group`, such as `storageclasses.storage.k8s.io.`.
|
|
||||||
|
|
||||||
* `--include-cluster-scope-resources`, `--include-namespaced-resources`, `--exclude-cluster-scope-resources` and `--exclude-namespaced-resources` parameters are mutual exclusive with `--include-cluster-resources`, `--include-resources` and `--exclude-resources` parameters. If both sets of parameters are provisioned, validation failure should be returned.
|
|
||||||
|
|
||||||
* `--include-cluster-scope-resources` and `--exclude-cluster-scope-resources` should only contain cluster scope resource type names. If namespace scope resource type names are included, they are ignored.
|
|
||||||
|
|
||||||
* If there are conflicts between `--include-cluster-scope-resources` and `--exclude-cluster-scope-resources` specified resources type lists, `--exclude-cluster-scope-resources` parameter has higher priority.
|
|
||||||
|
|
||||||
* `--include-namespaced-resources` and `--exclude-namespaced-resources` should only contain namespace scope resource type names. If cluster scope resource type names are included, they are ignored.
|
|
||||||
|
|
||||||
* If there are conflicts between `--include-namespaced-resources` and `--exclude-namespaced-resources` specified resources type lists, `--exclude-namespaced-resources` parameter has higher priority.
|
|
||||||
|
|
||||||
* If `--include-namespaced-resources` is not present, it means all namespace scope resources are included per resource type.
|
|
||||||
|
|
||||||
* If both `--include-cluster-scope-resources` and `--exclude-cluster-scope-resources` are not present, it means no additional cluster resource is included per resource type, just as the existing `--include-cluster-resources` parameter not setting value. Cluster resources are related to the namespace scope resources, which means those are returned in the namespace resources' BackupItemAction's result AdditionalItems array, are still included in backup by default. Taking backing up PVC scenario as an example, PVC is namespaced, PV is in cluster scope. PVC's BIA will include PVC related PV into backup too.
|
|
||||||
|
|
||||||
### Using scenarios:
|
|
||||||
Please notice, if the scenario give the example of using old filtering parameters (`--include-cluster-resources`, `--include-resources` and `--exclude-resources`), that means the old parameters also work for this case. If old parameters example is not given, that means they don't work for this scenario, only new parameters (`--include-cluster-scope-resources`, `--include-namespaced-resources`, `--exclude-cluster-scope-resources` and `--exclude-namespaced-resources`) work.
|
|
||||||
|
|
||||||
#### no namespaced resources + some cluster resources
|
|
||||||
The following command means backup no namespaced resources and some cluster resources.
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--exclude-namespaced-resources=*
|
|
||||||
--include-cluster-scope-resources=storageclass
|
|
||||||
```
|
|
||||||
|
|
||||||
#### no namespaced resources + all cluster resources
|
|
||||||
The following command means backup no namespaced resources and all cluster resources.
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--exclude-namespaced-resources=*
|
|
||||||
--include-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
#### some namespaced resources + no cluster resources
|
|
||||||
##### scenario 1
|
|
||||||
The following commands mean backup all resources in namespaces default and kube-system, and no cluster resources.
|
|
||||||
|
|
||||||
Example of new parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--exclude-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
Example of old parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-cluster-resources=false
|
|
||||||
```
|
|
||||||
##### scenario 2
|
|
||||||
The following commands mean backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in all namespaces, and no cluster resources. Although PVC's related PV should be included, due to no cluster resources are included, so they are ruled out too.
|
|
||||||
|
|
||||||
Example of new parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaced-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
|
||||||
--exclude-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
Example of old parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
|
||||||
--include-cluster-resources=false
|
|
||||||
```
|
|
||||||
##### scenario 3
|
|
||||||
The following commands mean backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in namespace default and kube-system, and no cluster resources. Although PVC's related PV should be included, due to no cluster resources are included, so they are ruled out too.
|
|
||||||
|
|
||||||
Example of new parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-namespaced-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
|
||||||
--exclude-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
Example of old parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
|
||||||
--include-cluster-resources=false
|
|
||||||
```
|
|
||||||
##### scenario 4
|
|
||||||
The following commands mean backup all resources except Ingress type resources in all namespaces, and no cluster resources.
|
|
||||||
|
|
||||||
Example of new parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--exclude-namespaced-resources=ingress
|
|
||||||
--exclude-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
Example of old parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--exclude-resources=ingress
|
|
||||||
--include-cluster-resources=false
|
|
||||||
```
|
|
||||||
|
|
||||||
#### some namespaced resources + only related cluster resources
|
|
||||||
##### scenario 1
|
|
||||||
This means backup all resources in namespaces default and kube-system, and related cluster resources.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
```
|
|
||||||
|
|
||||||
##### scenario 2
|
|
||||||
This means backup pods and configmaps in namespaces default and kube-system, and related cluster resources.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-namespaced-resources=pods,configmaps
|
|
||||||
```
|
|
||||||
|
|
||||||
##### scenario 3
|
|
||||||
This means backup all resources except Ingress type resources in all namespaces, and related cluster resources.
|
|
||||||
|
|
||||||
Example of new parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--exclude-namespaced-resources=ingress
|
|
||||||
```
|
|
||||||
|
|
||||||
Example of old parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--exclude-resources=ingress
|
|
||||||
```
|
|
||||||
|
|
||||||
#### some namespaced resources + some additional cluster resources
|
|
||||||
##### scenario 1
|
|
||||||
This means backup all resources in namespace in default, kube-system, and related cluster resources, plus all StorageClass cluster resources.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-cluster-scope-resources=storageclass
|
|
||||||
```
|
|
||||||
|
|
||||||
##### scenario 2
|
|
||||||
This means backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in all namespaces, and related cluster resources, plus all StorageClass cluster resources, and PVC related PV.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaced-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
|
||||||
--include-cluster-scope-resources=storageclass
|
|
||||||
```
|
|
||||||
|
|
||||||
##### scenario 3
|
|
||||||
This means backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in default and kube-system namespaces, and related cluster resources, plus all StorageClass cluster resources, and PVC related PV.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaced-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-cluster-scope-resources=storageclass
|
|
||||||
```
|
|
||||||
|
|
||||||
##### scenario 4
|
|
||||||
This means backup PVC, Deployment, Service, Endpoint, Pod and ReplicaSet resources in default and kube-system namespaces, and related cluster resources, plus all cluster scope resources except StorageClass type resources.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaced-resources=persistentvolumeclaim,deployment,service,endpoint,pod,replicaset
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--exclude-cluster-scope-resources=storageclass
|
|
||||||
```
|
|
||||||
|
|
||||||
#### some namespaced resources + all cluster resources
|
|
||||||
##### scenario 1
|
|
||||||
The following commands mean backup all resources in namespace in default, kube-system, and all cluster resources.
|
|
||||||
|
|
||||||
Example of new parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
Example of old parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-cluster-resources=true
|
|
||||||
```
|
|
||||||
|
|
||||||
##### scenario 2
|
|
||||||
This means backup Deployment, Service, Endpoint, Pod and ReplicaSet resources in all namespaces, and all cluster resources.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaced-resources=deployment,service,endpoint,pod,replicaset
|
|
||||||
--include-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
##### scenario 3
|
|
||||||
This means backup Deployment, Service, Endpoint, Pod and ReplicaSet resources in default and kube-system namespaces, and all cluster resources.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=default,kube-system
|
|
||||||
--include-namespaced-resources=deployment,service,endpoint,pod,replicaset
|
|
||||||
--include-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
#### all namespaced resources + no cluster resources
|
|
||||||
The following commands all mean backup all namespace scope resources and no cluster resources.
|
|
||||||
|
|
||||||
Example of new parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--exclude-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
Example of old parameters:
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-cluster-resources=false
|
|
||||||
```
|
|
||||||
|
|
||||||
#### all namespaced resources + some additional cluster resources
|
|
||||||
This command means backup all namespace scope resources, and related cluster resources, plus all PersistentVolume resources.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-namespaces=*
|
|
||||||
--include-cluster-scope-resources=persistentvolume
|
|
||||||
```
|
|
||||||
|
|
||||||
#### all namespaced resources + all cluster resources
|
|
||||||
The following commands have the same meaning: backup all namespace scope resources, and all cluster scope resources.
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-cluster-scope-resources=*
|
|
||||||
```
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
velero backup create <backup-name>
|
|
||||||
--include-cluster-resources=true
|
|
||||||
```
|
|
||||||
|
|
||||||
#### describe command change
|
|
||||||
In `velero backup describe` command, the four new parameters should be outputted too.
|
|
||||||
``` bash
|
|
||||||
velero backup describe <backup-name>
|
|
||||||
......
|
|
||||||
|
|
||||||
Namespaces:
|
|
||||||
Included: ns2
|
|
||||||
Excluded: <none>
|
|
||||||
|
|
||||||
Resources:
|
|
||||||
Included: <none>
|
|
||||||
Excluded: <none>
|
|
||||||
Included-cluster-scope: StorageClass,PersistentVolume
|
|
||||||
Excluded-cluster-scope: <none>
|
|
||||||
Included-namespaced: default
|
|
||||||
Excluded-namespaced: <none>
|
|
||||||
Cluster-scoped: auto
|
|
||||||
|
|
||||||
......
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note:** `velero restore` command doesn't support those four new parameter in Velero v1.11, but `velero schedule` supports the four new parameters through backup specification.
|
|
||||||
|
|
||||||
## Detailed Design
|
|
||||||
With adding `IncludedNamespacedResources`, `ExcludedNamespacedResources`, `IncludedClusterScopeResources` and `ExcludedClusterScopeResources`, the `BackupSpec` looks like:
|
|
||||||
``` go
|
|
||||||
type BackupSpec struct {
|
|
||||||
......
|
|
||||||
// IncludedResources is a slice of resource names to include
|
|
||||||
// in the backup. If empty, all resources are included.
|
|
||||||
// +optional
|
|
||||||
// +nullable
|
|
||||||
IncludedResources []string `json:"includedResources,omitempty"`
|
|
||||||
|
|
||||||
// ExcludedResources is a slice of resource names that are not
|
|
||||||
// included in the backup.
|
|
||||||
// +optional
|
|
||||||
// +nullable
|
|
||||||
ExcludedResources []string `json:"excludedResources,omitempty"`
|
|
||||||
|
|
||||||
// IncludeClusterResources specifies whether cluster-scoped resources
|
|
||||||
// should be included for consideration in the backup.
|
|
||||||
// +optional
|
|
||||||
// +nullable
|
|
||||||
IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
|
|
||||||
|
|
||||||
// IncludedClusterScopeResources is a slice of cluster scope
|
|
||||||
// resource type names to include in the backup.
|
|
||||||
// If set to "*", all cluster scope resource types are included.
|
|
||||||
// The default value is empty, which means only related cluster
|
|
||||||
// scope resources are included.
|
|
||||||
// +optional
|
|
||||||
// +nullable
|
|
||||||
IncludedClusterScopeResources []string `json:"includedClusterScopeResources,omitempty"`
|
|
||||||
|
|
||||||
// ExcludedClusterScopeResources is a slice of cluster scope
|
|
||||||
// resource type names to exclude from the backup.
|
|
||||||
// If set to "*", all cluster scope resource types are excluded.
|
|
||||||
// +optional
|
|
||||||
// +nullable
|
|
||||||
ExcludedClusterScopeResources []string `json:"excludedClusterScopeResources,omitempty"`
|
|
||||||
|
|
||||||
// IncludedNamespacedResources is a slice of namespace scope
|
|
||||||
// resource type names to include in the backup.
|
|
||||||
// The default value is "*".
|
|
||||||
// +optional
|
|
||||||
// +nullable
|
|
||||||
IncludedNamespacedResources []string `json:"includedNamespacedResources,omitempty"`
|
|
||||||
|
|
||||||
// ExcludedNamespacedResources is a slice of namespace scope
|
|
||||||
// resource type names to exclude from the backup.
|
|
||||||
// If set to "*", all namespace scope resource types are excluded.
|
|
||||||
// +optional
|
|
||||||
// +nullable
|
|
||||||
ExcludedNamespacedResources []string `json:"excludedNamespacedResources,omitempty"`
|
|
||||||
......
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Alternatives Considered
|
|
||||||
Proposal from Jibu Data [Issue 5120](https://github.com/vmware-tanzu/velero/issues/5120#issue-1304534563)
|
|
||||||
|
|
||||||
## Security Considerations
|
|
||||||
No security impact.
|
|
||||||
|
|
||||||
## Compatibility
|
|
||||||
The four new parameters cannot be mixed with existing resource filter parameters: `IncludedResources`, `ExcludedResources` and `IncludeClusterResources`.
|
|
||||||
If the new parameters and old parameters both appears in command line, or are specified in backup spec, the command line and the backup should fail.
|
|
||||||
|
|
||||||
## Implementation
|
|
||||||
This change should be included into Velero v1.11.
|
|
||||||
New parameters will coexist with `IncludedResources`, `ExcludedResources` and `IncludeClusterResources`.
|
|
||||||
Plan to deprecate `IncludedResources`, `ExcludedResources` and `IncludeClusterResources` in future releases, but also open to the community's feedback.
|
|
||||||
|
|
||||||
## Open Issues
|
|
||||||
`LabelSelector/OrLabelSelectors` apply to namespaced scope resources.
|
|
||||||
It may be reasonable to make them also working on cluster scope resources.
|
|
||||||
An issue is created to trace this topic [resource label selector not work for cluster scope resources](https://github.com/vmware-tanzu/velero/issues/5787)
|
|
||||||
@@ -53,35 +53,37 @@ type BackupSpec struct {
|
|||||||
// +nullable
|
// +nullable
|
||||||
ExcludedResources []string `json:"excludedResources,omitempty"`
|
ExcludedResources []string `json:"excludedResources,omitempty"`
|
||||||
|
|
||||||
// IncludedClusterScopeResources is a slice of cluster scope
|
// IncludedClusterScopedResources is a slice of cluster-scoped
|
||||||
// resource type names to include in the backup.
|
// resource type names to include in the backup.
|
||||||
// If set to "*", all cluster scope resource types are included.
|
// If set to "*", all cluster-scoped resource types are included.
|
||||||
// The default value is empty, which means only related cluster
|
// The default value is empty, which means only related
|
||||||
// scope resources are included.
|
// cluster-scoped resources are included.
|
||||||
// +optional
|
// +optional
|
||||||
// +nullable
|
// +nullable
|
||||||
IncludedClusterScopeResources []string `json:"includedClusterScopeResources,omitempty"`
|
IncludedClusterScopedResources []string `json:"includedClusterScopedResources,omitempty"`
|
||||||
|
|
||||||
// ExcludedClusterScopeResources is a slice of cluster scope
|
// ExcludedClusterScopedResources is a slice of cluster-scoped
|
||||||
// resource type names to exclude from the backup.
|
// resource type names to exclude from the backup.
|
||||||
// If set to "*", all cluster scope resource types are excluded.
|
// If set to "*", all cluster-scoped resource types are excluded.
|
||||||
|
// The default value is empty.
|
||||||
// +optional
|
// +optional
|
||||||
// +nullable
|
// +nullable
|
||||||
ExcludedClusterScopeResources []string `json:"excludedClusterScopeResources,omitempty"`
|
ExcludedClusterScopedResources []string `json:"excludedClusterScopedResources,omitempty"`
|
||||||
|
|
||||||
// IncludedNamespacedResources is a slice of namespace scope
|
// IncludedNamespaceScopedResources is a slice of namespace-scoped
|
||||||
// resource type names to include in the backup.
|
// resource type names to include in the backup.
|
||||||
// The default value is "*".
|
// The default value is "*".
|
||||||
// +optional
|
// +optional
|
||||||
// +nullable
|
// +nullable
|
||||||
IncludedNamespacedResources []string `json:"includedNamespacedResources,omitempty"`
|
IncludedNamespaceScopedResources []string `json:"includedNamespaceScopedResources,omitempty"`
|
||||||
|
|
||||||
// ExcludedNamespacedResources is a slice of namespace scope
|
// ExcludedNamespaceScopedResources is a slice of namespace-scoped
|
||||||
// resource type names to exclude from the backup.
|
// resource type names to exclude from the backup.
|
||||||
// If set to "*", all namespace scope resource types are excluded.
|
// If set to "*", all namespace-scoped resource types are excluded.
|
||||||
|
// The default value is empty.
|
||||||
// +optional
|
// +optional
|
||||||
// +nullable
|
// +nullable
|
||||||
ExcludedNamespacedResources []string `json:"excludedNamespacedResources,omitempty"`
|
ExcludedNamespaceScopedResources []string `json:"excludedNamespaceScopedResources,omitempty"`
|
||||||
|
|
||||||
// LabelSelector is a metav1.LabelSelector to filter with
|
// LabelSelector is a metav1.LabelSelector to filter with
|
||||||
// when adding individual objects to the backup. If empty
|
// when adding individual objects to the backup. If empty
|
||||||
|
|||||||
@@ -299,23 +299,23 @@ func (in *BackupSpec) DeepCopyInto(out *BackupSpec) {
|
|||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
if in.IncludedClusterScopeResources != nil {
|
if in.IncludedClusterScopedResources != nil {
|
||||||
in, out := &in.IncludedClusterScopeResources, &out.IncludedClusterScopeResources
|
in, out := &in.IncludedClusterScopedResources, &out.IncludedClusterScopedResources
|
||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
if in.ExcludedClusterScopeResources != nil {
|
if in.ExcludedClusterScopedResources != nil {
|
||||||
in, out := &in.ExcludedClusterScopeResources, &out.ExcludedClusterScopeResources
|
in, out := &in.ExcludedClusterScopedResources, &out.ExcludedClusterScopedResources
|
||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
if in.IncludedNamespacedResources != nil {
|
if in.IncludedNamespaceScopedResources != nil {
|
||||||
in, out := &in.IncludedNamespacedResources, &out.IncludedNamespacedResources
|
in, out := &in.IncludedNamespaceScopedResources, &out.IncludedNamespaceScopedResources
|
||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
if in.ExcludedNamespacedResources != nil {
|
if in.ExcludedNamespaceScopedResources != nil {
|
||||||
in, out := &in.ExcludedNamespacedResources, &out.ExcludedNamespacedResources
|
in, out := &in.ExcludedNamespaceScopedResources, &out.ExcludedNamespaceScopedResources
|
||||||
*out = make([]string, len(*in))
|
*out = make([]string, len(*in))
|
||||||
copy(*out, *in)
|
copy(*out, *in)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,10 +211,10 @@ func (kb *kubernetesBackupper) BackupWithResolvers(log logrus.FieldLogger,
|
|||||||
*backupRequest.NamespaceIncludesExcludes)
|
*backupRequest.NamespaceIncludesExcludes)
|
||||||
} else {
|
} else {
|
||||||
backupRequest.ResourceIncludesExcludes = collections.GetScopeResourceIncludesExcludes(kb.discoveryHelper, log,
|
backupRequest.ResourceIncludesExcludes = collections.GetScopeResourceIncludesExcludes(kb.discoveryHelper, log,
|
||||||
backupRequest.Spec.IncludedNamespacedResources,
|
backupRequest.Spec.IncludedNamespaceScopedResources,
|
||||||
backupRequest.Spec.ExcludedNamespacedResources,
|
backupRequest.Spec.ExcludedNamespaceScopedResources,
|
||||||
backupRequest.Spec.IncludedClusterScopeResources,
|
backupRequest.Spec.IncludedClusterScopedResources,
|
||||||
backupRequest.Spec.ExcludedClusterScopeResources,
|
backupRequest.Spec.ExcludedClusterScopedResources,
|
||||||
*backupRequest.NamespaceIncludesExcludes,
|
*backupRequest.NamespaceIncludesExcludes,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3279,8 +3279,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
actions []biav2.BackupItemAction
|
actions []biav2.BackupItemAction
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "no namespaced resources + some cluster resources",
|
name: "no namespace-scoped resources + some cluster-scoped resources",
|
||||||
backup: defaultBackup().IncludedClusterScopeResources("persistentvolumes").ExcludedNamespacedResources("*").Result(),
|
backup: defaultBackup().IncludedClusterScopedResources("persistentvolumes").ExcludedNamespaceScopedResources("*").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3300,8 +3300,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no namespaced resources + all cluster resources",
|
name: "no namespace-scoped resources + all cluster-scoped resources",
|
||||||
backup: defaultBackup().IncludedClusterScopeResources("*").ExcludedNamespacedResources("*").Result(),
|
backup: defaultBackup().IncludedClusterScopedResources("*").ExcludedNamespaceScopedResources("*").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3329,8 +3329,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + no cluster resources 1",
|
name: "some namespace-scoped resources + no cluster-scoped resources 1",
|
||||||
backup: defaultBackup().ExcludedClusterScopeResources("*").IncludedNamespaces("foo", "zoo").Result(),
|
backup: defaultBackup().ExcludedClusterScopedResources("*").IncludedNamespaces("foo", "zoo").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3360,8 +3360,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + no cluster resources 2",
|
name: "some namespace-scoped resources + no cluster-scoped resources 2",
|
||||||
backup: defaultBackup().ExcludedClusterScopeResources("*").IncludedNamespacedResources("pods", "deployments").Result(),
|
backup: defaultBackup().ExcludedClusterScopedResources("*").IncludedNamespaceScopedResources("pods", "deployments").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3391,8 +3391,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + no cluster resources 3",
|
name: "some namespace-scoped resources + no cluster-scoped resources 3",
|
||||||
backup: defaultBackup().ExcludedClusterScopeResources("*").IncludedNamespaces("foo").IncludedNamespacedResources("pods", "deployments").Result(),
|
backup: defaultBackup().ExcludedClusterScopedResources("*").IncludedNamespaces("foo").IncludedNamespaceScopedResources("pods", "deployments").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3418,8 +3418,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + no cluster resources 4",
|
name: "some namespace-scoped resources + no cluster-scoped resources 4",
|
||||||
backup: defaultBackup().ExcludedClusterScopeResources("*").ExcludedNamespacedResources("pods").Result(),
|
backup: defaultBackup().ExcludedClusterScopedResources("*").ExcludedNamespaceScopedResources("pods").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3445,8 +3445,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + only related cluster resources 2",
|
name: "some namespace-scoped resources + only related cluster-scoped resources 2",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespacedResources("pods", "persistentvolumeclaims").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespaceScopedResources("pods", "persistentvolumeclaims").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Volumes(builder.ForVolume("foo").PersistentVolumeClaimSource("test-1").Result()).Result(),
|
builder.ForPod("foo", "bar").Volumes(builder.ForVolume("foo").PersistentVolumeClaimSource("test-1").Result()).Result(),
|
||||||
@@ -3486,8 +3486,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + only related cluster resources 3",
|
name: "some namespace-scoped resources + only related cluster-scoped resources 3",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").ExcludedNamespacedResources("deployments").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").ExcludedNamespaceScopedResources("deployments").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Volumes(builder.ForVolume("foo").PersistentVolumeClaimSource("test-1").Result()).Result(),
|
builder.ForPod("foo", "bar").Volumes(builder.ForVolume("foo").PersistentVolumeClaimSource("test-1").Result()).Result(),
|
||||||
@@ -3526,8 +3526,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + some additional cluster resources 1",
|
name: "some namespace-scoped resources + some additional cluster-scoped resources 1",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedClusterScopeResources("customresourcedefinitions").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedClusterScopedResources("customresourcedefinitions").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3574,8 +3574,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + some additional cluster resources 2",
|
name: "some namespace-scoped resources + some additional cluster-scoped resources 2",
|
||||||
backup: defaultBackup().IncludedNamespacedResources("persistentvolumeclaims").IncludedClusterScopeResources("customresourcedefinitions").Result(),
|
backup: defaultBackup().IncludedNamespaceScopedResources("persistentvolumeclaims").IncludedClusterScopedResources("customresourcedefinitions").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3618,8 +3618,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + some additional cluster resources 3",
|
name: "some namespace-scoped resources + some additional cluster-scoped resources 3",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespacedResources("pods", "persistentvolumeclaims").IncludedClusterScopeResources("customresourcedefinitions").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespaceScopedResources("pods", "persistentvolumeclaims").IncludedClusterScopedResources("customresourcedefinitions").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3664,8 +3664,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + some additional cluster resources 4",
|
name: "some namespace-scoped resources + some additional cluster-scoped resources 4",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespacedResources("pods", "persistentvolumeclaims").IncludedClusterScopeResources("*").ExcludedClusterScopeResources("customresourcedefinitions.apiextensions.k8s.io").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespaceScopedResources("pods", "persistentvolumeclaims").IncludedClusterScopedResources("*").ExcludedClusterScopedResources("customresourcedefinitions.apiextensions.k8s.io").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3710,8 +3710,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + all cluster resources 1",
|
name: "some namespace-scoped resources + all cluster-scoped resources 1",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedClusterScopeResources("*").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedClusterScopedResources("*").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3743,8 +3743,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + all cluster resources 2",
|
name: "some namespace-scoped resources + all cluster-scoped resources 2",
|
||||||
backup: defaultBackup().IncludedNamespacedResources("pods").IncludedClusterScopeResources("*").Result(),
|
backup: defaultBackup().IncludedNamespaceScopedResources("pods").IncludedClusterScopedResources("*").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3776,8 +3776,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "some namespaced resources + all cluster resources 3",
|
name: "some namespace-scoped resources + all cluster-scoped resources 3",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespacedResources("pods").IncludedClusterScopeResources("*").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespaceScopedResources("pods").IncludedClusterScopedResources("*").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3807,8 +3807,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "all namespaced resources + no cluster resources",
|
name: "all namespace-scoped resources + no cluster-scoped resources",
|
||||||
backup: defaultBackup().ExcludedClusterScopeResources("*").Result(),
|
backup: defaultBackup().ExcludedClusterScopedResources("*").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3838,8 +3838,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "all namespaced resources + all cluster resources",
|
name: "all namespace-scoped resources + all cluster-scoped resources",
|
||||||
backup: defaultBackup().IncludedClusterScopeResources("*").Result(),
|
backup: defaultBackup().IncludedClusterScopedResources("*").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(
|
test.Pods(
|
||||||
builder.ForPod("foo", "bar").Result(),
|
builder.ForPod("foo", "bar").Result(),
|
||||||
@@ -3876,7 +3876,7 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "namespace resource should be included even it's not specified in the include list, when IncludedNamespaces has specified value 1",
|
name: "namespace resource should be included even it's not specified in the include list, when IncludedNamespaces has specified value 1",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespacedResources("Secrets").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespaceScopedResources("Secrets").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Secrets(
|
test.Secrets(
|
||||||
builder.ForSecret("foo", "bar").Result(),
|
builder.ForSecret("foo", "bar").Result(),
|
||||||
@@ -3902,7 +3902,7 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "namespace resource should be included even it's not specified in the include list, when IncludedNamespaces has specified value 2",
|
name: "namespace resource should be included even it's not specified in the include list, when IncludedNamespaces has specified value 2",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedClusterScopeResources("persistentvolumes").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedClusterScopedResources("persistentvolumes").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Secrets(
|
test.Secrets(
|
||||||
builder.ForSecret("foo", "bar").Result(),
|
builder.ForSecret("foo", "bar").Result(),
|
||||||
@@ -3932,7 +3932,7 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "namespace resource should be included even it's not specified in the include list, when IncludedNamespaces is asterisk.",
|
name: "namespace resource should be included even it's not specified in the include list, when IncludedNamespaces is asterisk.",
|
||||||
backup: defaultBackup().IncludedNamespaces("*").IncludedClusterScopeResources("persistentvolumes").Result(),
|
backup: defaultBackup().IncludedNamespaces("*").IncludedClusterScopedResources("persistentvolumes").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Secrets(
|
test.Secrets(
|
||||||
builder.ForSecret("foo", "bar").Result(),
|
builder.ForSecret("foo", "bar").Result(),
|
||||||
@@ -3968,8 +3968,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "when all namespace resources are involved, cluster resources should be included too",
|
name: "when all namespace-scoped resources are involved, cluster-scoped resources should be included too",
|
||||||
backup: defaultBackup().IncludedNamespaces("*").IncludedNamespacedResources("*").Result(),
|
backup: defaultBackup().IncludedNamespaces("*").IncludedNamespaceScopedResources("*").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Secrets(
|
test.Secrets(
|
||||||
builder.ForSecret("foo", "bar").Result(),
|
builder.ForSecret("foo", "bar").Result(),
|
||||||
@@ -4008,8 +4008,8 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "IncludedNamespaces is asterisk, but not all namespaced types are include, additional cluster resource should not be included.",
|
name: "IncludedNamespaces is asterisk, but not all namespace-scoped resource types are include, additional cluster-scoped resources should not be included.",
|
||||||
backup: defaultBackup().IncludedNamespaces("*").IncludedNamespacedResources("secrets").Result(),
|
backup: defaultBackup().IncludedNamespaces("*").IncludedNamespaceScopedResources("secrets").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Secrets(
|
test.Secrets(
|
||||||
builder.ForSecret("foo", "bar").Result(),
|
builder.ForSecret("foo", "bar").Result(),
|
||||||
@@ -4041,7 +4041,7 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Resource's CRD should be included",
|
name: "Resource's CRD should be included",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespacedResources("volumesnapshotlocations.velero.io", "backups.velero.io").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespaceScopedResources("volumesnapshotlocations.velero.io", "backups.velero.io").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.CRDs(
|
test.CRDs(
|
||||||
builder.ForCustomResourceDefinitionV1Beta1("backups.velero.io").Result(),
|
builder.ForCustomResourceDefinitionV1Beta1("backups.velero.io").Result(),
|
||||||
@@ -4064,7 +4064,7 @@ func TestBackupNewResourceFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Resource's CRD is not included, when CRD is excluded.",
|
name: "Resource's CRD is not included, when CRD is excluded.",
|
||||||
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespacedResources("volumesnapshotlocations.velero.io", "backups.velero.io").ExcludedClusterScopeResources("customresourcedefinitions.apiextensions.k8s.io").Result(),
|
backup: defaultBackup().IncludedNamespaces("foo").IncludedNamespaceScopedResources("volumesnapshotlocations.velero.io", "backups.velero.io").ExcludedClusterScopedResources("customresourcedefinitions.apiextensions.k8s.io").Result(),
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.CRDs(
|
test.CRDs(
|
||||||
builder.ForCustomResourceDefinitionV1Beta1("backups.velero.io").Result(),
|
builder.ForCustomResourceDefinitionV1Beta1("backups.velero.io").Result(),
|
||||||
|
|||||||
@@ -156,27 +156,27 @@ func (b *BackupBuilder) ExcludedResources(resources ...string) *BackupBuilder {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// IncludedClusterScopeResources sets the Backup's included cluster resources.
|
// IncludedClusterScopedResources sets the Backup's included cluster resources.
|
||||||
func (b *BackupBuilder) IncludedClusterScopeResources(resources ...string) *BackupBuilder {
|
func (b *BackupBuilder) IncludedClusterScopedResources(resources ...string) *BackupBuilder {
|
||||||
b.object.Spec.IncludedClusterScopeResources = resources
|
b.object.Spec.IncludedClusterScopedResources = resources
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExcludedClusterScopeResources sets the Backup's excluded cluster resources.
|
// ExcludedClusterScopedResources sets the Backup's excluded cluster resources.
|
||||||
func (b *BackupBuilder) ExcludedClusterScopeResources(resources ...string) *BackupBuilder {
|
func (b *BackupBuilder) ExcludedClusterScopedResources(resources ...string) *BackupBuilder {
|
||||||
b.object.Spec.ExcludedClusterScopeResources = resources
|
b.object.Spec.ExcludedClusterScopedResources = resources
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// IncludedNamespacedResources sets the Backup's included namespaced resources.
|
// IncludedNamespaceScopedResources sets the Backup's included namespaced resources.
|
||||||
func (b *BackupBuilder) IncludedNamespacedResources(resources ...string) *BackupBuilder {
|
func (b *BackupBuilder) IncludedNamespaceScopedResources(resources ...string) *BackupBuilder {
|
||||||
b.object.Spec.IncludedNamespacedResources = resources
|
b.object.Spec.IncludedNamespaceScopedResources = resources
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExcludedNamespacedResources sets the Backup's excluded namespaced resources.
|
// ExcludedNamespaceScopedResources sets the Backup's excluded namespaced resources.
|
||||||
func (b *BackupBuilder) ExcludedNamespacedResources(resources ...string) *BackupBuilder {
|
func (b *BackupBuilder) ExcludedNamespaceScopedResources(resources ...string) *BackupBuilder {
|
||||||
b.object.Spec.ExcludedNamespacedResources = resources
|
b.object.Spec.ExcludedNamespaceScopedResources = resources
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,30 +82,30 @@ func NewCreateCommand(f client.Factory, use string) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateOptions struct {
|
type CreateOptions struct {
|
||||||
Name string
|
Name string
|
||||||
TTL time.Duration
|
TTL time.Duration
|
||||||
SnapshotVolumes flag.OptionalBool
|
SnapshotVolumes flag.OptionalBool
|
||||||
DefaultVolumesToFsBackup flag.OptionalBool
|
DefaultVolumesToFsBackup flag.OptionalBool
|
||||||
IncludeNamespaces flag.StringArray
|
IncludeNamespaces flag.StringArray
|
||||||
ExcludeNamespaces flag.StringArray
|
ExcludeNamespaces flag.StringArray
|
||||||
IncludeResources flag.StringArray
|
IncludeResources flag.StringArray
|
||||||
ExcludeResources flag.StringArray
|
ExcludeResources flag.StringArray
|
||||||
IncludeClusterScopeResources flag.StringArray
|
IncludeClusterScopedResources flag.StringArray
|
||||||
ExcludeClusterScopeResources flag.StringArray
|
ExcludeClusterScopedResources flag.StringArray
|
||||||
IncludeNamespacedResources flag.StringArray
|
IncludeNamespaceScopedResources flag.StringArray
|
||||||
ExcludeNamespacedResources flag.StringArray
|
ExcludeNamespaceScopedResources flag.StringArray
|
||||||
Labels flag.Map
|
Labels flag.Map
|
||||||
Selector flag.LabelSelector
|
Selector flag.LabelSelector
|
||||||
IncludeClusterResources flag.OptionalBool
|
IncludeClusterResources flag.OptionalBool
|
||||||
Wait bool
|
Wait bool
|
||||||
StorageLocation string
|
StorageLocation string
|
||||||
SnapshotLocations []string
|
SnapshotLocations []string
|
||||||
FromSchedule string
|
FromSchedule string
|
||||||
OrderedResources string
|
OrderedResources string
|
||||||
CSISnapshotTimeout time.Duration
|
CSISnapshotTimeout time.Duration
|
||||||
ItemOperationTimeout time.Duration
|
ItemOperationTimeout time.Duration
|
||||||
ResPoliciesConfigmap string
|
ResPoliciesConfigmap string
|
||||||
client veleroclient.Interface
|
client veleroclient.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCreateOptions() *CreateOptions {
|
func NewCreateOptions() *CreateOptions {
|
||||||
@@ -121,12 +121,12 @@ func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) {
|
|||||||
flags.DurationVar(&o.TTL, "ttl", o.TTL, "How long before the backup can be garbage collected.")
|
flags.DurationVar(&o.TTL, "ttl", o.TTL, "How long before the backup can be garbage collected.")
|
||||||
flags.Var(&o.IncludeNamespaces, "include-namespaces", "Namespaces to include in the backup (use '*' for all namespaces).")
|
flags.Var(&o.IncludeNamespaces, "include-namespaces", "Namespaces to include in the backup (use '*' for all namespaces).")
|
||||||
flags.Var(&o.ExcludeNamespaces, "exclude-namespaces", "Namespaces to exclude from the backup.")
|
flags.Var(&o.ExcludeNamespaces, "exclude-namespaces", "Namespaces to exclude from the backup.")
|
||||||
flags.Var(&o.IncludeResources, "include-resources", "Resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources). Cannot work with include-cluster-scope-resources, exclude-cluster-scope-resources, include-namespaced-resources and exclude-namespaced-resources.")
|
flags.Var(&o.IncludeResources, "include-resources", "Resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources). Cannot work with include-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources.")
|
||||||
flags.Var(&o.ExcludeResources, "exclude-resources", "Resources to exclude from the backup, formatted as resource.group, such as storageclasses.storage.k8s.io. Cannot work with include-cluster-scope-resources, exclude-cluster-scope-resources, include-namespaced-resources and exclude-namespaced-resources.")
|
flags.Var(&o.ExcludeResources, "exclude-resources", "Resources to exclude from the backup, formatted as resource.group, such as storageclasses.storage.k8s.io. Cannot work with include-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources.")
|
||||||
flags.Var(&o.IncludeClusterScopeResources, "include-cluster-scope-resources", "Cluster-scoped resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
|
flags.Var(&o.IncludeClusterScopedResources, "include-cluster-scoped-resources", "Cluster-scoped resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
|
||||||
flags.Var(&o.ExcludeClusterScopeResources, "exclude-cluster-scope-resources", "Cluster-scoped resources to exclude from the backup, formatted as resource.group, such as storageclasses.storage.k8s.io(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
|
flags.Var(&o.ExcludeClusterScopedResources, "exclude-cluster-scoped-resources", "Cluster-scoped resources to exclude from the backup, formatted as resource.group, such as storageclasses.storage.k8s.io(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
|
||||||
flags.Var(&o.IncludeNamespacedResources, "include-namespaced-resources", "Namespaced resources to include in the backup, formatted as resource.group, such as deployments.apps(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
|
flags.Var(&o.IncludeNamespaceScopedResources, "include-namespace-scoped-resources", "Namespaced resources to include in the backup, formatted as resource.group, such as deployments.apps(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
|
||||||
flags.Var(&o.ExcludeNamespacedResources, "exclude-namespaced-resources", "Namespaced resources to exclude from the backup, formatted as resource.group, such as deployments.apps(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
|
flags.Var(&o.ExcludeNamespaceScopedResources, "exclude-namespace-scoped-resources", "Namespaced resources to exclude from the backup, formatted as resource.group, such as deployments.apps(use '*' for all resources). Cannot work with include-resources, exclude-resources and include-cluster-resources.")
|
||||||
flags.Var(&o.Labels, "labels", "Labels to apply to the backup.")
|
flags.Var(&o.Labels, "labels", "Labels to apply to the backup.")
|
||||||
flags.StringVar(&o.StorageLocation, "storage-location", "", "Location in which to store the backup.")
|
flags.StringVar(&o.StorageLocation, "storage-location", "", "Location in which to store the backup.")
|
||||||
flags.StringSliceVar(&o.SnapshotLocations, "volume-snapshot-locations", o.SnapshotLocations, "List of locations (at most one per provider) where volume snapshots should be stored.")
|
flags.StringSliceVar(&o.SnapshotLocations, "volume-snapshot-locations", o.SnapshotLocations, "List of locations (at most one per provider) where volume snapshots should be stored.")
|
||||||
@@ -139,7 +139,7 @@ func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) {
|
|||||||
// like a normal bool flag
|
// like a normal bool flag
|
||||||
f.NoOptDefVal = "true"
|
f.NoOptDefVal = "true"
|
||||||
|
|
||||||
f = flags.VarPF(&o.IncludeClusterResources, "include-cluster-resources", "", "Include cluster-scoped resources in the backup. Cannot work with include-cluster-scope-resources, exclude-cluster-scope-resources, include-namespaced-resources and exclude-namespaced-resources.")
|
f = flags.VarPF(&o.IncludeClusterResources, "include-cluster-resources", "", "Include cluster-scoped resources in the backup. Cannot work with include-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources.")
|
||||||
f.NoOptDefVal = "true"
|
f.NoOptDefVal = "true"
|
||||||
|
|
||||||
f = flags.VarPF(&o.DefaultVolumesToFsBackup, "default-volumes-to-fs-backup", "", "Use pod volume file system backup by default for volumes")
|
f = flags.VarPF(&o.DefaultVolumesToFsBackup, "default-volumes-to-fs-backup", "", "Use pod volume file system backup by default for volumes")
|
||||||
@@ -182,7 +182,7 @@ func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Facto
|
|||||||
|
|
||||||
if o.oldAndNewFilterParametersUsedTogether() {
|
if o.oldAndNewFilterParametersUsedTogether() {
|
||||||
return fmt.Errorf("include-resources, exclude-resources and include-cluster-resources are old filter parameters.\n" +
|
return fmt.Errorf("include-resources, exclude-resources and include-cluster-resources are old filter parameters.\n" +
|
||||||
"include-cluster-scope-resources, exclude-cluster-scope-resources, include-namespaced-resources and exclude-namespaced-resources are new filter parameters.\n" +
|
"include-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources are new filter parameters.\n" +
|
||||||
"They cannot be used together")
|
"They cannot be used together")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,10 +350,10 @@ func (o *CreateOptions) BuildBackup(namespace string) (*velerov1api.Backup, erro
|
|||||||
ExcludedNamespaces(o.ExcludeNamespaces...).
|
ExcludedNamespaces(o.ExcludeNamespaces...).
|
||||||
IncludedResources(o.IncludeResources...).
|
IncludedResources(o.IncludeResources...).
|
||||||
ExcludedResources(o.ExcludeResources...).
|
ExcludedResources(o.ExcludeResources...).
|
||||||
IncludedClusterScopeResources(o.IncludeClusterScopeResources...).
|
IncludedClusterScopedResources(o.IncludeClusterScopedResources...).
|
||||||
ExcludedClusterScopeResources(o.ExcludeClusterScopeResources...).
|
ExcludedClusterScopedResources(o.ExcludeClusterScopedResources...).
|
||||||
IncludedNamespacedResources(o.IncludeNamespacedResources...).
|
IncludedNamespaceScopedResources(o.IncludeNamespaceScopedResources...).
|
||||||
ExcludedNamespacedResources(o.ExcludeNamespacedResources...).
|
ExcludedNamespaceScopedResources(o.ExcludeNamespaceScopedResources...).
|
||||||
LabelSelector(o.Selector.LabelSelector).
|
LabelSelector(o.Selector.LabelSelector).
|
||||||
TTL(o.TTL).
|
TTL(o.TTL).
|
||||||
StorageLocation(o.StorageLocation).
|
StorageLocation(o.StorageLocation).
|
||||||
@@ -390,10 +390,10 @@ func (o *CreateOptions) oldAndNewFilterParametersUsedTogether() bool {
|
|||||||
haveOldResourceFilterParameters := len(o.IncludeResources) > 0 ||
|
haveOldResourceFilterParameters := len(o.IncludeResources) > 0 ||
|
||||||
len(o.ExcludeResources) > 0 ||
|
len(o.ExcludeResources) > 0 ||
|
||||||
o.IncludeClusterResources.Value != nil
|
o.IncludeClusterResources.Value != nil
|
||||||
haveNewResourceFilterParameters := len(o.IncludeClusterScopeResources) > 0 ||
|
haveNewResourceFilterParameters := len(o.IncludeClusterScopedResources) > 0 ||
|
||||||
(len(o.ExcludeClusterScopeResources) > 0) ||
|
(len(o.ExcludeClusterScopedResources) > 0) ||
|
||||||
(len(o.IncludeNamespacedResources) > 0) ||
|
(len(o.IncludeNamespaceScopedResources) > 0) ||
|
||||||
(len(o.ExcludeNamespacedResources) > 0)
|
(len(o.ExcludeNamespaceScopedResources) > 0)
|
||||||
|
|
||||||
return haveOldResourceFilterParameters && haveNewResourceFilterParameters
|
return haveOldResourceFilterParameters && haveNewResourceFilterParameters
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,24 +135,24 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
|
|||||||
},
|
},
|
||||||
Spec: api.ScheduleSpec{
|
Spec: api.ScheduleSpec{
|
||||||
Template: api.BackupSpec{
|
Template: api.BackupSpec{
|
||||||
IncludedNamespaces: o.BackupOptions.IncludeNamespaces,
|
IncludedNamespaces: o.BackupOptions.IncludeNamespaces,
|
||||||
ExcludedNamespaces: o.BackupOptions.ExcludeNamespaces,
|
ExcludedNamespaces: o.BackupOptions.ExcludeNamespaces,
|
||||||
IncludedResources: o.BackupOptions.IncludeResources,
|
IncludedResources: o.BackupOptions.IncludeResources,
|
||||||
ExcludedResources: o.BackupOptions.ExcludeResources,
|
ExcludedResources: o.BackupOptions.ExcludeResources,
|
||||||
IncludedClusterScopeResources: o.BackupOptions.IncludeClusterScopeResources,
|
IncludedClusterScopedResources: o.BackupOptions.IncludeClusterScopedResources,
|
||||||
ExcludedClusterScopeResources: o.BackupOptions.ExcludeClusterScopeResources,
|
ExcludedClusterScopedResources: o.BackupOptions.ExcludeClusterScopedResources,
|
||||||
IncludedNamespacedResources: o.BackupOptions.IncludeNamespacedResources,
|
IncludedNamespaceScopedResources: o.BackupOptions.IncludeNamespaceScopedResources,
|
||||||
ExcludedNamespacedResources: o.BackupOptions.ExcludeNamespacedResources,
|
ExcludedNamespaceScopedResources: o.BackupOptions.ExcludeNamespaceScopedResources,
|
||||||
IncludeClusterResources: o.BackupOptions.IncludeClusterResources.Value,
|
IncludeClusterResources: o.BackupOptions.IncludeClusterResources.Value,
|
||||||
LabelSelector: o.BackupOptions.Selector.LabelSelector,
|
LabelSelector: o.BackupOptions.Selector.LabelSelector,
|
||||||
SnapshotVolumes: o.BackupOptions.SnapshotVolumes.Value,
|
SnapshotVolumes: o.BackupOptions.SnapshotVolumes.Value,
|
||||||
TTL: metav1.Duration{Duration: o.BackupOptions.TTL},
|
TTL: metav1.Duration{Duration: o.BackupOptions.TTL},
|
||||||
StorageLocation: o.BackupOptions.StorageLocation,
|
StorageLocation: o.BackupOptions.StorageLocation,
|
||||||
VolumeSnapshotLocations: o.BackupOptions.SnapshotLocations,
|
VolumeSnapshotLocations: o.BackupOptions.SnapshotLocations,
|
||||||
DefaultVolumesToFsBackup: o.BackupOptions.DefaultVolumesToFsBackup.Value,
|
DefaultVolumesToFsBackup: o.BackupOptions.DefaultVolumesToFsBackup.Value,
|
||||||
OrderedResources: orders,
|
OrderedResources: orders,
|
||||||
CSISnapshotTimeout: metav1.Duration{Duration: o.BackupOptions.CSISnapshotTimeout},
|
CSISnapshotTimeout: metav1.Duration{Duration: o.BackupOptions.CSISnapshotTimeout},
|
||||||
ItemOperationTimeout: metav1.Duration{Duration: o.BackupOptions.ItemOperationTimeout},
|
ItemOperationTimeout: metav1.Duration{Duration: o.BackupOptions.ItemOperationTimeout},
|
||||||
},
|
},
|
||||||
Schedule: o.Schedule,
|
Schedule: o.Schedule,
|
||||||
UseOwnerReferencesInBackup: &o.UseOwnerReferencesInBackup,
|
UseOwnerReferencesInBackup: &o.UseOwnerReferencesInBackup,
|
||||||
|
|||||||
@@ -150,8 +150,8 @@ func DescribeBackupSpec(d *Describer, spec velerov1api.BackupSpec) {
|
|||||||
d.Printf("\tExcluded:\t%s\n", s)
|
d.Printf("\tExcluded:\t%s\n", s)
|
||||||
|
|
||||||
d.Println()
|
d.Println()
|
||||||
|
d.Printf("Resources:\n")
|
||||||
if collections.UseOldResourceFilters(spec) {
|
if collections.UseOldResourceFilters(spec) {
|
||||||
d.Printf("Resources:\n")
|
|
||||||
if len(spec.IncludedResources) == 0 {
|
if len(spec.IncludedResources) == 0 {
|
||||||
s = "*"
|
s = "*"
|
||||||
} else {
|
} else {
|
||||||
@@ -166,31 +166,31 @@ func DescribeBackupSpec(d *Describer, spec velerov1api.BackupSpec) {
|
|||||||
d.Printf("\tExcluded:\t%s\n", s)
|
d.Printf("\tExcluded:\t%s\n", s)
|
||||||
d.Printf("\tCluster-scoped:\t%s\n", BoolPointerString(spec.IncludeClusterResources, "excluded", "included", "auto"))
|
d.Printf("\tCluster-scoped:\t%s\n", BoolPointerString(spec.IncludeClusterResources, "excluded", "included", "auto"))
|
||||||
} else {
|
} else {
|
||||||
if len(spec.IncludedClusterScopeResources) == 0 {
|
if len(spec.IncludedClusterScopedResources) == 0 {
|
||||||
s = emptyDisplay
|
s = emptyDisplay
|
||||||
} else {
|
} else {
|
||||||
s = strings.Join(spec.IncludedClusterScopeResources, ", ")
|
s = strings.Join(spec.IncludedClusterScopedResources, ", ")
|
||||||
}
|
}
|
||||||
d.Printf("\tIncluded cluster-scoped:\t%s\n", s)
|
d.Printf("\tIncluded cluster-scoped:\t%s\n", s)
|
||||||
if len(spec.ExcludedClusterScopeResources) == 0 {
|
if len(spec.ExcludedClusterScopedResources) == 0 {
|
||||||
s = emptyDisplay
|
s = emptyDisplay
|
||||||
} else {
|
} else {
|
||||||
s = strings.Join(spec.ExcludedClusterScopeResources, ", ")
|
s = strings.Join(spec.ExcludedClusterScopedResources, ", ")
|
||||||
}
|
}
|
||||||
d.Printf("\tExcluded cluster-scoped:\t%s\n", s)
|
d.Printf("\tExcluded cluster-scoped:\t%s\n", s)
|
||||||
|
|
||||||
if len(spec.IncludedNamespacedResources) == 0 {
|
if len(spec.IncludedNamespaceScopedResources) == 0 {
|
||||||
s = "*"
|
s = "*"
|
||||||
} else {
|
} else {
|
||||||
s = strings.Join(spec.IncludedNamespacedResources, ", ")
|
s = strings.Join(spec.IncludedNamespaceScopedResources, ", ")
|
||||||
}
|
}
|
||||||
d.Printf("\tIncluded namespaced:\t%s\n", s)
|
d.Printf("\tIncluded namespace-scoped:\t%s\n", s)
|
||||||
if len(spec.ExcludedNamespacedResources) == 0 {
|
if len(spec.ExcludedNamespaceScopedResources) == 0 {
|
||||||
s = emptyDisplay
|
s = emptyDisplay
|
||||||
} else {
|
} else {
|
||||||
s = strings.Join(spec.ExcludedNamespacedResources, ", ")
|
s = strings.Join(spec.ExcludedNamespaceScopedResources, ", ")
|
||||||
}
|
}
|
||||||
d.Printf("\tExcluded namespaced:\t%s\n", s)
|
d.Printf("\tExcluded namespace-scoped:\t%s\n", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Println()
|
d.Println()
|
||||||
|
|||||||
@@ -435,10 +435,10 @@ func (b *backupReconciler) prepareBackupRequest(backup *velerov1api.Backup, logg
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validate whether Included/Excluded resources and IncludedClusterResource are mixed with
|
// validate whether Included/Excluded resources and IncludedClusterResource are mixed with
|
||||||
// Included/Excluded cluster-scoped/namespaced resources.
|
// Included/Excluded cluster-scoped/namespace-scoped resources.
|
||||||
if oldAndNewFilterParametersUsedTogether(request.Spec) {
|
if oldAndNewFilterParametersUsedTogether(request.Spec) {
|
||||||
validatedError := fmt.Sprintf("include-resources, exclude-resources and include-cluster-resources are old filter parameters.\n" +
|
validatedError := fmt.Sprintf("include-resources, exclude-resources and include-cluster-resources are old filter parameters.\n" +
|
||||||
"include-cluster-scope-resources, exclude-cluster-scope-resources, include-namespaced-resources and exclude-namespaced-resources are new filter parameters.\n" +
|
"include-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources are new filter parameters.\n" +
|
||||||
"They cannot be used together")
|
"They cannot be used together")
|
||||||
request.Status.ValidationErrors = append(request.Status.ValidationErrors, validatedError)
|
request.Status.ValidationErrors = append(request.Status.ValidationErrors, validatedError)
|
||||||
}
|
}
|
||||||
@@ -449,13 +449,13 @@ func (b *backupReconciler) prepareBackupRequest(backup *velerov1api.Backup, logg
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validate the cluster-scoped included/excluded resources
|
// validate the cluster-scoped included/excluded resources
|
||||||
for _, err := range collections.ValidateScopedIncludesExcludes(request.Spec.IncludedClusterScopeResources, request.Spec.ExcludedClusterScopeResources) {
|
for _, err := range collections.ValidateScopedIncludesExcludes(request.Spec.IncludedClusterScopedResources, request.Spec.ExcludedClusterScopedResources) {
|
||||||
request.Status.ValidationErrors = append(request.Status.ValidationErrors, fmt.Sprintf("Invalid cluster-scoped included/excluded resource lists: %s", err))
|
request.Status.ValidationErrors = append(request.Status.ValidationErrors, fmt.Sprintf("Invalid cluster-scoped included/excluded resource lists: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate the namespaced included/excluded resources
|
// validate the namespace-scoped included/excluded resources
|
||||||
for _, err := range collections.ValidateScopedIncludesExcludes(request.Spec.IncludedNamespacedResources, request.Spec.ExcludedNamespacedResources) {
|
for _, err := range collections.ValidateScopedIncludesExcludes(request.Spec.IncludedNamespaceScopedResources, request.Spec.ExcludedNamespaceScopedResources) {
|
||||||
request.Status.ValidationErrors = append(request.Status.ValidationErrors, fmt.Sprintf("Invalid namespaced included/excluded resource lists: %s", err))
|
request.Status.ValidationErrors = append(request.Status.ValidationErrors, fmt.Sprintf("Invalid namespace-scoped included/excluded resource lists: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate the included/excluded namespaces
|
// validate the included/excluded namespaces
|
||||||
@@ -1146,10 +1146,10 @@ func oldAndNewFilterParametersUsedTogether(backupSpec velerov1api.BackupSpec) bo
|
|||||||
haveOldResourceFilterParameters := len(backupSpec.IncludedResources) > 0 ||
|
haveOldResourceFilterParameters := len(backupSpec.IncludedResources) > 0 ||
|
||||||
(len(backupSpec.ExcludedResources) > 0) ||
|
(len(backupSpec.ExcludedResources) > 0) ||
|
||||||
(backupSpec.IncludeClusterResources != nil)
|
(backupSpec.IncludeClusterResources != nil)
|
||||||
haveNewResourceFilterParameters := len(backupSpec.IncludedClusterScopeResources) > 0 ||
|
haveNewResourceFilterParameters := len(backupSpec.IncludedClusterScopedResources) > 0 ||
|
||||||
(len(backupSpec.ExcludedClusterScopeResources) > 0) ||
|
(len(backupSpec.ExcludedClusterScopedResources) > 0) ||
|
||||||
(len(backupSpec.IncludedNamespacedResources) > 0) ||
|
(len(backupSpec.IncludedNamespaceScopedResources) > 0) ||
|
||||||
(len(backupSpec.ExcludedNamespacedResources) > 0)
|
(len(backupSpec.ExcludedNamespaceScopedResources) > 0)
|
||||||
|
|
||||||
return haveOldResourceFilterParameters && haveNewResourceFilterParameters
|
return haveOldResourceFilterParameters && haveNewResourceFilterParameters
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,9 +182,9 @@ func TestProcessBackupValidationFailures(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "use old filter parameters and new filter parameters together",
|
name: "use old filter parameters and new filter parameters together",
|
||||||
backup: defaultBackup().IncludeClusterResources(true).IncludedNamespacedResources("Deployment").IncludedNamespaces("default").Result(),
|
backup: defaultBackup().IncludeClusterResources(true).IncludedNamespaceScopedResources("Deployment").IncludedNamespaces("default").Result(),
|
||||||
backupLocation: defaultBackupLocation,
|
backupLocation: defaultBackupLocation,
|
||||||
expectedErrs: []string{"include-resources, exclude-resources and include-cluster-resources are old filter parameters.\ninclude-cluster-scope-resources, exclude-cluster-scope-resources, include-namespaced-resources and exclude-namespaced-resources are new filter parameters.\nThey cannot be used together"},
|
expectedErrs: []string{"include-resources, exclude-resources and include-cluster-resources are old filter parameters.\ninclude-cluster-scoped-resources, exclude-cluster-scoped-resources, include-namespace-scoped-resources and exclude-namespace-scoped-resources are new filter parameters.\nThey cannot be used together"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,20 +189,20 @@ func (ie *GlobalIncludesExcludes) ShouldExclude(typeName string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ScopeIncludesExcludes struct {
|
type ScopeIncludesExcludes struct {
|
||||||
namespaceResourceFilter IncludesExcludes // namespace scope resource filter
|
namespaceScopedResourceFilter IncludesExcludes // namespace-scoped resource filter
|
||||||
clusterResourceFilter IncludesExcludes // cluster scope resource filter
|
clusterScopedResourceFilter IncludesExcludes // cluster-scoped resource filter
|
||||||
namespaceFilter IncludesExcludes // namespace filter
|
namespaceFilter IncludesExcludes // namespace filter
|
||||||
|
|
||||||
helper discovery.Helper
|
helper discovery.Helper
|
||||||
logger logrus.FieldLogger
|
logger logrus.FieldLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShouldInclude returns whether the specified resource should be included or not.
|
// ShouldInclude returns whether the specified resource should be included or not.
|
||||||
// The function will check whether the resource is namespaced resource first.
|
// The function will check whether the resource is namespace-scoped resource first.
|
||||||
// For namespaced resource, except resources listed in excludes, other things should be included.
|
// For namespace-scoped resource, except resources listed in excludes, other things should be included.
|
||||||
// For cluster resource, except resources listed in excludes, only include the resource specified by the included.
|
// For cluster-scoped resource, except resources listed in excludes, only include the resource specified by the included.
|
||||||
// It also has some exceptional checks. For namespace, as long as it's not excluded, it is involved.
|
// It also has some exceptional checks. For namespace, as long as it's not excluded, it is involved.
|
||||||
// If all namespace resources are included, all cluster resource are returned to get a full backup.
|
// If all namespace-scoped resources are included, all cluster-scoped resource are returned to get a full backup.
|
||||||
func (ie *ScopeIncludesExcludes) ShouldInclude(typeName string) bool {
|
func (ie *ScopeIncludesExcludes) ShouldInclude(typeName string) bool {
|
||||||
_, resource, err := ie.helper.ResourceFor(schema.ParseGroupResource(typeName).WithVersion(""))
|
_, resource, err := ie.helper.ResourceFor(schema.ParseGroupResource(typeName).WithVersion(""))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -211,30 +211,30 @@ func (ie *ScopeIncludesExcludes) ShouldInclude(typeName string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resource.Namespaced {
|
if resource.Namespaced {
|
||||||
if ie.namespaceResourceFilter.excludes.Has("*") || ie.namespaceResourceFilter.excludes.match(typeName) {
|
if ie.namespaceScopedResourceFilter.excludes.Has("*") || ie.namespaceScopedResourceFilter.excludes.match(typeName) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// len=0 means include everything
|
// len=0 means include everything
|
||||||
return ie.namespaceResourceFilter.includes.Len() == 0 || ie.namespaceResourceFilter.includes.Has("*") || ie.namespaceResourceFilter.includes.match(typeName)
|
return ie.namespaceScopedResourceFilter.includes.Len() == 0 || ie.namespaceScopedResourceFilter.includes.Has("*") || ie.namespaceScopedResourceFilter.includes.match(typeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ie.clusterResourceFilter.excludes.Has("*") || ie.clusterResourceFilter.excludes.match(typeName) {
|
if ie.clusterScopedResourceFilter.excludes.Has("*") || ie.clusterScopedResourceFilter.excludes.match(typeName) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// when IncludedClusterScopeResources and ExcludedClusterScopeResources are not specified,
|
// when IncludedClusterScopedResources and ExcludedClusterScopedResources are not specified,
|
||||||
// only directly back up cluster-scoped resources if we're doing a full-cluster
|
// only directly back up cluster-scoped resources if we're doing a full-cluster
|
||||||
// (all namespaces and all namespace scope types) backup.
|
// (all namespaces and all namespace-scoped types) backup.
|
||||||
if len(ie.clusterResourceFilter.includes.List()) == 0 &&
|
if len(ie.clusterScopedResourceFilter.includes.List()) == 0 &&
|
||||||
len(ie.clusterResourceFilter.excludes.List()) == 0 &&
|
len(ie.clusterScopedResourceFilter.excludes.List()) == 0 &&
|
||||||
ie.namespaceFilter.IncludeEverything() &&
|
ie.namespaceFilter.IncludeEverything() &&
|
||||||
ie.namespaceResourceFilter.IncludeEverything() {
|
ie.namespaceScopedResourceFilter.IncludeEverything() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also include namespace resource by default.
|
// Also include namespace resource by default.
|
||||||
return ie.clusterResourceFilter.includes.Has("*") || ie.clusterResourceFilter.includes.match(typeName) || typeName == kuberesource.Namespaces.String()
|
return ie.clusterScopedResourceFilter.includes.Has("*") || ie.clusterScopedResourceFilter.includes.match(typeName) || typeName == kuberesource.Namespaces.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShouldExclude returns whether the resource type should be excluded or not.
|
// ShouldExclude returns whether the resource type should be excluded or not.
|
||||||
@@ -248,11 +248,11 @@ func (ie *ScopeIncludesExcludes) ShouldExclude(typeName string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resource.Namespaced {
|
if resource.Namespaced {
|
||||||
if ie.namespaceResourceFilter.excludes.match(typeName) {
|
if ie.namespaceScopedResourceFilter.excludes.match(typeName) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ie.clusterResourceFilter.excludes.match(typeName) {
|
if ie.clusterScopedResourceFilter.excludes.match(typeName) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,11 +286,11 @@ func (ie *IncludesExcludes) IncludeEverything() bool {
|
|||||||
|
|
||||||
func newScopeIncludesExcludes(nsIncludesExcludes IncludesExcludes, helper discovery.Helper, logger logrus.FieldLogger) *ScopeIncludesExcludes {
|
func newScopeIncludesExcludes(nsIncludesExcludes IncludesExcludes, helper discovery.Helper, logger logrus.FieldLogger) *ScopeIncludesExcludes {
|
||||||
ret := &ScopeIncludesExcludes{
|
ret := &ScopeIncludesExcludes{
|
||||||
namespaceResourceFilter: IncludesExcludes{
|
namespaceScopedResourceFilter: IncludesExcludes{
|
||||||
includes: newGlobStringSet(),
|
includes: newGlobStringSet(),
|
||||||
excludes: newGlobStringSet(),
|
excludes: newGlobStringSet(),
|
||||||
},
|
},
|
||||||
clusterResourceFilter: IncludesExcludes{
|
clusterScopedResourceFilter: IncludesExcludes{
|
||||||
includes: newGlobStringSet(),
|
includes: newGlobStringSet(),
|
||||||
excludes: newGlobStringSet(),
|
excludes: newGlobStringSet(),
|
||||||
},
|
},
|
||||||
@@ -353,7 +353,7 @@ func ValidateNamespaceIncludesExcludes(includesList, excludesList []string) []er
|
|||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateScopedIncludesExcludes checks provided lists of namespaced or cluster-scoped
|
// ValidateScopedIncludesExcludes checks provided lists of namespace-scoped or cluster-scoped
|
||||||
// included and excluded items to ensure they are a valid set of IncludesExcludes data.
|
// included and excluded items to ensure they are a valid set of IncludesExcludes data.
|
||||||
func ValidateScopedIncludesExcludes(includesList, excludesList []string) []error {
|
func ValidateScopedIncludesExcludes(includesList, excludesList []string) []error {
|
||||||
var errs []error
|
var errs []error
|
||||||
@@ -447,10 +447,10 @@ func generateIncludesExcludes(includes, excludes []string, mapFunc func(string)
|
|||||||
func generateScopedIncludesExcludes(namespacedIncludes, namespacedExcludes, clusterIncludes, clusterExcludes []string, mapFunc func(string, bool) string, nsIncludesExcludes IncludesExcludes, helper discovery.Helper, logger logrus.FieldLogger) *ScopeIncludesExcludes {
|
func generateScopedIncludesExcludes(namespacedIncludes, namespacedExcludes, clusterIncludes, clusterExcludes []string, mapFunc func(string, bool) string, nsIncludesExcludes IncludesExcludes, helper discovery.Helper, logger logrus.FieldLogger) *ScopeIncludesExcludes {
|
||||||
res := newScopeIncludesExcludes(nsIncludesExcludes, helper, logger)
|
res := newScopeIncludesExcludes(nsIncludesExcludes, helper, logger)
|
||||||
|
|
||||||
generateFilter(res.namespaceResourceFilter.includes, namespacedIncludes, mapFunc, true)
|
generateFilter(res.namespaceScopedResourceFilter.includes, namespacedIncludes, mapFunc, true)
|
||||||
generateFilter(res.namespaceResourceFilter.excludes, namespacedExcludes, mapFunc, true)
|
generateFilter(res.namespaceScopedResourceFilter.excludes, namespacedExcludes, mapFunc, true)
|
||||||
generateFilter(res.clusterResourceFilter.includes, clusterIncludes, mapFunc, false)
|
generateFilter(res.clusterScopedResourceFilter.includes, clusterIncludes, mapFunc, false)
|
||||||
generateFilter(res.clusterResourceFilter.excludes, clusterExcludes, mapFunc, false)
|
generateFilter(res.clusterScopedResourceFilter.excludes, clusterExcludes, mapFunc, false)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
@@ -509,7 +509,7 @@ func GetGlobalResourceIncludesExcludes(helper discovery.Helper, logger logrus.Fi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetScopeResourceIncludesExcludes's function is similar with GetResourceIncludesExcludes,
|
// GetScopeResourceIncludesExcludes's function is similar with GetResourceIncludesExcludes,
|
||||||
// but it's used for scoped Includes/Excludes, and can handle both cluster and namespace resources.
|
// but it's used for scoped Includes/Excludes, and can handle both cluster-scoped and namespace-scoped resources.
|
||||||
func GetScopeResourceIncludesExcludes(helper discovery.Helper, logger logrus.FieldLogger, namespaceIncludes, namespaceExcludes, clusterIncludes, clusterExcludes []string, nsIncludesExcludes IncludesExcludes) *ScopeIncludesExcludes {
|
func GetScopeResourceIncludesExcludes(helper discovery.Helper, logger logrus.FieldLogger, namespaceIncludes, namespaceExcludes, clusterIncludes, clusterExcludes []string, nsIncludesExcludes IncludesExcludes) *ScopeIncludesExcludes {
|
||||||
ret := generateScopedIncludesExcludes(
|
ret := generateScopedIncludesExcludes(
|
||||||
namespaceIncludes,
|
namespaceIncludes,
|
||||||
@@ -532,27 +532,27 @@ func GetScopeResourceIncludesExcludes(helper discovery.Helper, logger logrus.Fie
|
|||||||
helper,
|
helper,
|
||||||
logger,
|
logger,
|
||||||
)
|
)
|
||||||
logger.Infof("Including namespace scope resources: %s", ret.namespaceResourceFilter.IncludesString())
|
logger.Infof("Including namespace-scoped resources: %s", ret.namespaceScopedResourceFilter.IncludesString())
|
||||||
logger.Infof("Excluding namespace scope resources: %s", ret.namespaceResourceFilter.ExcludesString())
|
logger.Infof("Excluding namespace-scoped resources: %s", ret.namespaceScopedResourceFilter.ExcludesString())
|
||||||
logger.Infof("Including cluster scope resources: %s", ret.clusterResourceFilter.GetIncludes())
|
logger.Infof("Including cluster-scoped resources: %s", ret.clusterScopedResourceFilter.GetIncludes())
|
||||||
logger.Infof("Excluding cluster scope resources: %s", ret.clusterResourceFilter.ExcludesString())
|
logger.Infof("Excluding cluster-scoped resources: %s", ret.clusterScopedResourceFilter.ExcludesString())
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// UseOldResourceFilters checks whether to use old resource filters (IncludeClusterResources,
|
// UseOldResourceFilters checks whether to use old resource filters (IncludeClusterResources,
|
||||||
// IncludedResources and ExcludedResources), depending the backup's filters setting.
|
// IncludedResources and ExcludedResources), depending the backup's filters setting.
|
||||||
// New filters are IncludeClusterScopedResources, ExcludeClusterScopedResources,
|
// New filters are IncludedClusterScopedResources, ExcludedClusterScopedResources,
|
||||||
// IncludeNamespacedResources and ExcludeNamespacedResources.
|
// IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources.
|
||||||
func UseOldResourceFilters(backupSpec velerov1api.BackupSpec) bool {
|
func UseOldResourceFilters(backupSpec velerov1api.BackupSpec) bool {
|
||||||
// If all resource filters are none, it is treated as using old parameter filters.
|
// If all resource filters are none, it is treated as using old parameter filters.
|
||||||
if backupSpec.IncludeClusterResources == nil &&
|
if backupSpec.IncludeClusterResources == nil &&
|
||||||
len(backupSpec.IncludedResources) == 0 &&
|
len(backupSpec.IncludedResources) == 0 &&
|
||||||
len(backupSpec.ExcludedResources) == 0 &&
|
len(backupSpec.ExcludedResources) == 0 &&
|
||||||
len(backupSpec.IncludedClusterScopeResources) == 0 &&
|
len(backupSpec.IncludedClusterScopedResources) == 0 &&
|
||||||
len(backupSpec.ExcludedClusterScopeResources) == 0 &&
|
len(backupSpec.ExcludedClusterScopedResources) == 0 &&
|
||||||
len(backupSpec.IncludedNamespacedResources) == 0 &&
|
len(backupSpec.IncludedNamespaceScopedResources) == 0 &&
|
||||||
len(backupSpec.ExcludedNamespacedResources) == 0 {
|
len(backupSpec.ExcludedNamespaceScopedResources) == 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -370,14 +370,14 @@ func TestValidateScopedIncludesExcludes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNamespaceScopeShouldInclude(t *testing.T) {
|
func TestNamespaceScopedShouldInclude(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
namespaceIncludes []string
|
namespaceScopedIncludes []string
|
||||||
namespaceExcludes []string
|
namespaceScopedExcludes []string
|
||||||
item string
|
item string
|
||||||
want bool
|
want bool
|
||||||
apiResources []*test.APIResource
|
apiResources []*test.APIResource
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "empty string should include every item",
|
name: "empty string should include every item",
|
||||||
@@ -388,104 +388,104 @@ func TestNamespaceScopeShouldInclude(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "include * should include every item",
|
name: "include * should include every item",
|
||||||
namespaceIncludes: []string{"*"},
|
namespaceScopedIncludes: []string{"*"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "item in includes list should include item",
|
name: "item in includes list should include item",
|
||||||
namespaceIncludes: []string{"foo", "bar", "pods"},
|
namespaceScopedIncludes: []string{"foo", "bar", "pods"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "item not in includes list should not include item",
|
name: "item not in includes list should not include item",
|
||||||
namespaceIncludes: []string{"foo", "baz"},
|
namespaceScopedIncludes: []string{"foo", "baz"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "include *, excluded item should not include item",
|
name: "include *, excluded item should not include item",
|
||||||
namespaceIncludes: []string{"*"},
|
namespaceScopedIncludes: []string{"*"},
|
||||||
namespaceExcludes: []string{"pods"},
|
namespaceScopedExcludes: []string{"pods"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "include *, exclude foo, bar should be included",
|
name: "include *, exclude foo, bar should be included",
|
||||||
namespaceIncludes: []string{"*"},
|
namespaceScopedIncludes: []string{"*"},
|
||||||
namespaceExcludes: []string{"foo"},
|
namespaceScopedExcludes: []string{"foo"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "an item both included and excluded should not be included",
|
name: "an item both included and excluded should not be included",
|
||||||
namespaceIncludes: []string{"pods"},
|
namespaceScopedIncludes: []string{"pods"},
|
||||||
namespaceExcludes: []string{"pods"},
|
namespaceScopedExcludes: []string{"pods"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wildcard should include item",
|
name: "wildcard should include item",
|
||||||
namespaceIncludes: []string{"*s"},
|
namespaceScopedIncludes: []string{"*s"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wildcard mismatch should not include item",
|
name: "wildcard mismatch should not include item",
|
||||||
namespaceIncludes: []string{"*.bar"},
|
namespaceScopedIncludes: []string{"*.bar"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "exclude * should include nothing",
|
name: "exclude * should include nothing",
|
||||||
namespaceExcludes: []string{"*"},
|
namespaceScopedExcludes: []string{"*"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wildcard exclude should not include item",
|
name: "wildcard exclude should not include item",
|
||||||
namespaceIncludes: []string{"*"},
|
namespaceScopedIncludes: []string{"*"},
|
||||||
namespaceExcludes: []string{"*s"},
|
namespaceScopedExcludes: []string{"*s"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wildcard exclude mismatch should include item",
|
name: "wildcard exclude mismatch should include item",
|
||||||
namespaceExcludes: []string{"*.bar"},
|
namespaceScopedExcludes: []string{"*.bar"},
|
||||||
item: "pods",
|
item: "pods",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Pods(),
|
test.Pods(),
|
||||||
},
|
},
|
||||||
@@ -501,7 +501,7 @@ func TestNamespaceScopeShouldInclude(t *testing.T) {
|
|||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
discoveryHelper := setupDiscoveryClientWithResources(tc.apiResources)
|
discoveryHelper := setupDiscoveryClientWithResources(tc.apiResources)
|
||||||
logger := logrus.StandardLogger()
|
logger := logrus.StandardLogger()
|
||||||
scopeIncludesExcludes := GetScopeResourceIncludesExcludes(discoveryHelper, logger, tc.namespaceIncludes, tc.namespaceExcludes, []string{}, []string{}, *NewIncludesExcludes())
|
scopeIncludesExcludes := GetScopeResourceIncludesExcludes(discoveryHelper, logger, tc.namespaceScopedIncludes, tc.namespaceScopedExcludes, []string{}, []string{}, *NewIncludesExcludes())
|
||||||
|
|
||||||
if got := scopeIncludesExcludes.ShouldInclude((tc.item)); got != tc.want {
|
if got := scopeIncludesExcludes.ShouldInclude((tc.item)); got != tc.want {
|
||||||
t.Errorf("want %t, got %t", tc.want, got)
|
t.Errorf("want %t, got %t", tc.want, got)
|
||||||
@@ -512,13 +512,13 @@ func TestNamespaceScopeShouldInclude(t *testing.T) {
|
|||||||
|
|
||||||
func TestClusterScopedShouldInclude(t *testing.T) {
|
func TestClusterScopedShouldInclude(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
clusterIncludes []string
|
clusterScopedIncludes []string
|
||||||
clusterExcludes []string
|
clusterScopedExcludes []string
|
||||||
nsIncludes []string
|
nsIncludes []string
|
||||||
item string
|
item string
|
||||||
want bool
|
want bool
|
||||||
apiResources []*test.APIResource
|
apiResources []*test.APIResource
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "empty string should include nothing",
|
name: "empty string should include nothing",
|
||||||
@@ -530,106 +530,106 @@ func TestClusterScopedShouldInclude(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "include * should include every item",
|
name: "include * should include every item",
|
||||||
clusterIncludes: []string{"*"},
|
clusterScopedIncludes: []string{"*"},
|
||||||
item: "persistentvolumes",
|
item: "persistentvolumes",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.PVs(),
|
test.PVs(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "item in includes list should include item",
|
name: "item in includes list should include item",
|
||||||
clusterIncludes: []string{"namespaces", "bar", "baz"},
|
clusterScopedIncludes: []string{"namespaces", "bar", "baz"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "item not in includes list should not include item",
|
name: "item not in includes list should not include item",
|
||||||
clusterIncludes: []string{"foo", "baz"},
|
clusterScopedIncludes: []string{"foo", "baz"},
|
||||||
nsIncludes: []string{"default"},
|
nsIncludes: []string{"default"},
|
||||||
item: "persistentvolumes",
|
item: "persistentvolumes",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.PVs(),
|
test.PVs(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "include *, excluded item should not include item",
|
name: "include *, excluded item should not include item",
|
||||||
clusterIncludes: []string{"*"},
|
clusterScopedIncludes: []string{"*"},
|
||||||
clusterExcludes: []string{"namespaces"},
|
clusterScopedExcludes: []string{"namespaces"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "include *, exclude foo, bar should be included",
|
name: "include *, exclude foo, bar should be included",
|
||||||
clusterIncludes: []string{"*"},
|
clusterScopedIncludes: []string{"*"},
|
||||||
clusterExcludes: []string{"foo"},
|
clusterScopedExcludes: []string{"foo"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "an item both included and excluded should not be included",
|
name: "an item both included and excluded should not be included",
|
||||||
clusterIncludes: []string{"namespaces"},
|
clusterScopedIncludes: []string{"namespaces"},
|
||||||
clusterExcludes: []string{"namespaces"},
|
clusterScopedExcludes: []string{"namespaces"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wildcard should include item",
|
name: "wildcard should include item",
|
||||||
clusterIncludes: []string{"*spaces"},
|
clusterScopedIncludes: []string{"*spaces"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wildcard mismatch should not include item",
|
name: "wildcard mismatch should not include item",
|
||||||
clusterIncludes: []string{"*.bar"},
|
clusterScopedIncludes: []string{"*.bar"},
|
||||||
nsIncludes: []string{"default"},
|
nsIncludes: []string{"default"},
|
||||||
item: "persistentvolumes",
|
item: "persistentvolumes",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.PVs(),
|
test.PVs(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "exclude * should include nothing",
|
name: "exclude * should include nothing",
|
||||||
clusterExcludes: []string{"*"},
|
clusterScopedExcludes: []string{"*"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wildcard exclude should not include item",
|
name: "wildcard exclude should not include item",
|
||||||
clusterIncludes: []string{"*"},
|
clusterScopedIncludes: []string{"*"},
|
||||||
clusterExcludes: []string{"*spaces"},
|
clusterScopedExcludes: []string{"*spaces"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wildcard exclude mismatch should not include item",
|
name: "wildcard exclude mismatch should not include item",
|
||||||
clusterExcludes: []string{"*spaces"},
|
clusterScopedExcludes: []string{"*spaces"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
@@ -640,31 +640,31 @@ func TestClusterScopedShouldInclude(t *testing.T) {
|
|||||||
want: false,
|
want: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "even namespaces is not in the include list, it should also be involved.",
|
name: "even namespaces is not in the include list, it should also be involved.",
|
||||||
clusterIncludes: []string{"foo", "baz"},
|
clusterScopedIncludes: []string{"foo", "baz"},
|
||||||
item: "namespaces",
|
item: "namespaces",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Namespaces(),
|
test.Namespaces(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "When all namespaces and namespace scope resources are included, cluster resource should be included.",
|
name: "When all namespaces and namespace scope resources are included, cluster resource should be included.",
|
||||||
clusterIncludes: []string{},
|
clusterScopedIncludes: []string{},
|
||||||
nsIncludes: []string{"*"},
|
nsIncludes: []string{"*"},
|
||||||
item: "persistentvolumes",
|
item: "persistentvolumes",
|
||||||
want: true,
|
want: true,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.PVs(),
|
test.PVs(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "When all namespaces and namespace scope resources are included, but cluster resource is excluded.",
|
name: "When all namespaces and namespace scope resources are included, but cluster resource is excluded.",
|
||||||
clusterIncludes: []string{},
|
clusterScopedIncludes: []string{},
|
||||||
clusterExcludes: []string{"persistentvolumes"},
|
clusterScopedExcludes: []string{"persistentvolumes"},
|
||||||
nsIncludes: []string{"*"},
|
nsIncludes: []string{"*"},
|
||||||
item: "persistentvolumes",
|
item: "persistentvolumes",
|
||||||
want: false,
|
want: false,
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.PVs(),
|
test.PVs(),
|
||||||
},
|
},
|
||||||
@@ -675,7 +675,7 @@ func TestClusterScopedShouldInclude(t *testing.T) {
|
|||||||
discoveryHelper := setupDiscoveryClientWithResources(tc.apiResources)
|
discoveryHelper := setupDiscoveryClientWithResources(tc.apiResources)
|
||||||
logger := logrus.StandardLogger()
|
logger := logrus.StandardLogger()
|
||||||
nsIncludeExclude := NewIncludesExcludes().Includes(tc.nsIncludes...)
|
nsIncludeExclude := NewIncludesExcludes().Includes(tc.nsIncludes...)
|
||||||
scopeIncludesExcludes := GetScopeResourceIncludesExcludes(discoveryHelper, logger, []string{}, []string{}, tc.clusterIncludes, tc.clusterExcludes, *nsIncludeExclude)
|
scopeIncludesExcludes := GetScopeResourceIncludesExcludes(discoveryHelper, logger, []string{}, []string{}, tc.clusterScopedIncludes, tc.clusterScopedExcludes, *nsIncludeExclude)
|
||||||
|
|
||||||
if got := scopeIncludesExcludes.ShouldInclude((tc.item)); got != tc.want {
|
if got := scopeIncludesExcludes.ShouldInclude((tc.item)); got != tc.want {
|
||||||
t.Errorf("want %t, got %t", tc.want, got)
|
t.Errorf("want %t, got %t", tc.want, got)
|
||||||
@@ -686,25 +686,25 @@ func TestClusterScopedShouldInclude(t *testing.T) {
|
|||||||
|
|
||||||
func TestGetScopedResourceIncludesExcludes(t *testing.T) {
|
func TestGetScopedResourceIncludesExcludes(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
namespaceIncludes []string
|
namespaceScopedIncludes []string
|
||||||
namespaceExcludes []string
|
namespaceScopedExcludes []string
|
||||||
clusterIncludes []string
|
clusterScopedIncludes []string
|
||||||
clusterExcludes []string
|
clusterScopedExcludes []string
|
||||||
expectedNamespaceIncludes []string
|
expectedNamespaceScopedIncludes []string
|
||||||
expectedNamespaceExcludes []string
|
expectedNamespaceScopedExcludes []string
|
||||||
expectedClusterIncludes []string
|
expectedClusterScopedIncludes []string
|
||||||
expectedClusterExcludes []string
|
expectedClusterScopedExcludes []string
|
||||||
apiResources []*test.APIResource
|
apiResources []*test.APIResource
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "only include namespace resources in IncludesExcludes, when namespaced is set to true",
|
name: "only include namespace-scoped resources in IncludesExcludes",
|
||||||
namespaceIncludes: []string{"deployments.apps", "persistentvolumes"},
|
namespaceScopedIncludes: []string{"deployments.apps", "persistentvolumes"},
|
||||||
namespaceExcludes: []string{"pods", "persistentvolumes"},
|
namespaceScopedExcludes: []string{"pods", "persistentvolumes"},
|
||||||
expectedNamespaceIncludes: []string{"deployments.apps"},
|
expectedNamespaceScopedIncludes: []string{"deployments.apps"},
|
||||||
expectedNamespaceExcludes: []string{"pods"},
|
expectedNamespaceScopedExcludes: []string{"pods"},
|
||||||
expectedClusterIncludes: []string{},
|
expectedClusterScopedIncludes: []string{},
|
||||||
expectedClusterExcludes: []string{},
|
expectedClusterScopedExcludes: []string{},
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Deployments(),
|
test.Deployments(),
|
||||||
test.PVs(),
|
test.PVs(),
|
||||||
@@ -712,13 +712,13 @@ func TestGetScopedResourceIncludesExcludes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "only include cluster-scoped resources in IncludesExcludes, when namespaced is set to false",
|
name: "only include cluster-scoped resources in IncludesExcludes",
|
||||||
clusterIncludes: []string{"deployments.apps", "persistentvolumes"},
|
clusterScopedIncludes: []string{"deployments.apps", "persistentvolumes"},
|
||||||
clusterExcludes: []string{"pods", "persistentvolumes"},
|
clusterScopedExcludes: []string{"pods", "persistentvolumes"},
|
||||||
expectedNamespaceIncludes: []string{},
|
expectedNamespaceScopedIncludes: []string{},
|
||||||
expectedNamespaceExcludes: []string{},
|
expectedNamespaceScopedExcludes: []string{},
|
||||||
expectedClusterIncludes: []string{"persistentvolumes"},
|
expectedClusterScopedIncludes: []string{"persistentvolumes"},
|
||||||
expectedClusterExcludes: []string{"persistentvolumes"},
|
expectedClusterScopedExcludes: []string{"persistentvolumes"},
|
||||||
apiResources: []*test.APIResource{
|
apiResources: []*test.APIResource{
|
||||||
test.Deployments(),
|
test.Deployments(),
|
||||||
test.PVs(),
|
test.PVs(),
|
||||||
@@ -732,12 +732,12 @@ func TestGetScopedResourceIncludesExcludes(t *testing.T) {
|
|||||||
|
|
||||||
logger := logrus.StandardLogger()
|
logger := logrus.StandardLogger()
|
||||||
nsIncludeExclude := NewIncludesExcludes()
|
nsIncludeExclude := NewIncludesExcludes()
|
||||||
resources := GetScopeResourceIncludesExcludes(setupDiscoveryClientWithResources(tc.apiResources), logger, tc.namespaceIncludes, tc.namespaceExcludes, tc.clusterIncludes, tc.clusterExcludes, *nsIncludeExclude)
|
resources := GetScopeResourceIncludesExcludes(setupDiscoveryClientWithResources(tc.apiResources), logger, tc.namespaceScopedIncludes, tc.namespaceScopedExcludes, tc.clusterScopedIncludes, tc.clusterScopedExcludes, *nsIncludeExclude)
|
||||||
|
|
||||||
assert.Equal(t, tc.expectedNamespaceIncludes, resources.namespaceResourceFilter.includes.List())
|
assert.Equal(t, tc.expectedNamespaceScopedIncludes, resources.namespaceScopedResourceFilter.includes.List())
|
||||||
assert.Equal(t, tc.expectedNamespaceExcludes, resources.namespaceResourceFilter.excludes.List())
|
assert.Equal(t, tc.expectedNamespaceScopedExcludes, resources.namespaceScopedResourceFilter.excludes.List())
|
||||||
assert.Equal(t, tc.expectedClusterIncludes, resources.clusterResourceFilter.includes.List())
|
assert.Equal(t, tc.expectedClusterScopedIncludes, resources.clusterScopedResourceFilter.includes.List())
|
||||||
assert.Equal(t, tc.expectedClusterExcludes, resources.clusterResourceFilter.excludes.List())
|
assert.Equal(t, tc.expectedClusterScopedExcludes, resources.clusterScopedResourceFilter.excludes.List())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -760,7 +760,7 @@ func TestUseOldResourceFilters(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "backup with only new filters should use new filters",
|
name: "backup with only new filters should use new filters",
|
||||||
backup: *defaultBackup().IncludedClusterScopeResources("StorageClass").Result(),
|
backup: *defaultBackup().IncludedClusterScopedResources("StorageClass").Result(),
|
||||||
useOldResourceFilters: false,
|
useOldResourceFilters: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -768,7 +768,7 @@ func TestUseOldResourceFilters(t *testing.T) {
|
|||||||
// filters used together. So this is only used for UT checking, and I assume old filters
|
// filters used together. So this is only used for UT checking, and I assume old filters
|
||||||
// have higher priority, because old parameter should be the default one.
|
// have higher priority, because old parameter should be the default one.
|
||||||
name: "backup with both old and new filters should use old filters",
|
name: "backup with both old and new filters should use old filters",
|
||||||
backup: *defaultBackup().IncludeClusterResources(true).IncludedClusterScopeResources("StorageClass").Result(),
|
backup: *defaultBackup().IncludeClusterResources(true).IncludedClusterScopedResources("StorageClass").Result(),
|
||||||
useOldResourceFilters: true,
|
useOldResourceFilters: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ params:
|
|||||||
hero:
|
hero:
|
||||||
backgroundColor: med-blue
|
backgroundColor: med-blue
|
||||||
versioning: true
|
versioning: true
|
||||||
latest: v1.10
|
latest: v1.11
|
||||||
versions:
|
versions:
|
||||||
- main
|
- main
|
||||||
|
- v1.11
|
||||||
- v1.10
|
- v1.10
|
||||||
- v1.9
|
- v1.9
|
||||||
- v1.8
|
- v1.8
|
||||||
|
|||||||
@@ -77,22 +77,22 @@ spec:
|
|||||||
# (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified,
|
# (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified,
|
||||||
# no additional cluster-scoped resources are excluded. Optional.
|
# no additional cluster-scoped resources are excluded. Optional.
|
||||||
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
||||||
excludedClusterScopeResources: {}
|
excludedClusterScopedResources: {}
|
||||||
# Array of cluster-scoped resources to include from the backup. Resources may be shortcuts
|
# Array of cluster-scoped resources to include from the backup. Resources may be shortcuts
|
||||||
# (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified,
|
# (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified,
|
||||||
# no additional cluster-scoped resources are included. Optional.
|
# no additional cluster-scoped resources are included. Optional.
|
||||||
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
||||||
includedClusterScopeResources: {}
|
includedClusterScopedResources: {}
|
||||||
# Array of namespace resources to exclude from the backup. Resources may be shortcuts
|
# Array of namespace-scoped resources to exclude from the backup. Resources may be shortcuts
|
||||||
# (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified,
|
# (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified,
|
||||||
# no namespace resources are excluded. Optional.
|
# no namespace-scoped resources are excluded. Optional.
|
||||||
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
||||||
excludedNamespacedResources: {}
|
excludedNamespaceScopedResources: {}
|
||||||
# Array of namespace resources to include from the backup. Resources may be shortcuts
|
# Array of namespace-scoped resources to include from the backup. Resources may be shortcuts
|
||||||
# (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified,
|
# (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified,
|
||||||
# all namespace resources are included. Optional.
|
# all namespace-scoped resources are included. Optional.
|
||||||
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
||||||
includedNamespacedResources: {}
|
includedNamespaceScopedResources: {}
|
||||||
# Individual objects must match this label selector to be included in the backup. Optional.
|
# Individual objects must match this label selector to be included in the backup. Optional.
|
||||||
labelSelector:
|
labelSelector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
|
|||||||
@@ -73,22 +73,22 @@ spec:
|
|||||||
# (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified,
|
# (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified,
|
||||||
# no additional cluster-scoped resources are excluded. Optional.
|
# no additional cluster-scoped resources are excluded. Optional.
|
||||||
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
||||||
excludedClusterScopeResources: {}
|
excludedClusterScopedResources: {}
|
||||||
# Array of cluster-scoped resources to include from the backup. Resources may be shortcuts
|
# Array of cluster-scoped resources to include from the backup. Resources may be shortcuts
|
||||||
# (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified,
|
# (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified,
|
||||||
# no additional cluster-scoped resources are included. Optional.
|
# no additional cluster-scoped resources are included. Optional.
|
||||||
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
||||||
includedClusterScopeResources: {}
|
includedClusterScopedResources: {}
|
||||||
# Array of namespace resources to exclude from the backup. Resources may be shortcuts
|
# Array of namespace-scoped resources to exclude from the backup. Resources may be shortcuts
|
||||||
# (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified,
|
# (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified,
|
||||||
# no namespace resources are excluded. Optional.
|
# no namespace-scoped resources are excluded. Optional.
|
||||||
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
||||||
excludedNamespacedResources: {}
|
excludedNamespaceScopedResources: {}
|
||||||
# Array of namespace resources to include from the backup. Resources may be shortcuts
|
# Array of namespace-scoped resources to include from the backup. Resources may be shortcuts
|
||||||
# (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified,
|
# (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified,
|
||||||
# all namespace resources are included. Optional.
|
# all namespace-scoped resources are included. Optional.
|
||||||
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
# Cannot work with include-resources, exclude-resources and include-cluster-resources.
|
||||||
includedNamespacedResources: {}
|
includedNamespaceScopedResources: {}
|
||||||
# Individual objects must match this label selector to be included in the scheduled backup. Optional.
|
# Individual objects must match this label selector to be included in the scheduled backup. Optional.
|
||||||
labelSelector:
|
labelSelector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ The following are test cases that are not currently performed as part of a Veler
|
|||||||
- `velero.io/exclude-from-backup=true` label
|
- `velero.io/exclude-from-backup=true` label
|
||||||
|
|
||||||
- Since v1.11, new resource filters are added. The new filters only work for backup, and cannot work with old filters (`--include-resources`, `--exclude-resources` and `--include-cluster-resources`). Need to verify backups correctly apply the following new resource filters:
|
- Since v1.11, new resource filters are added. The new filters only work for backup, and cannot work with old filters (`--include-resources`, `--exclude-resources` and `--include-cluster-resources`). Need to verify backups correctly apply the following new resource filters:
|
||||||
- `--exclude-cluster-scope-resources`
|
- `--exclude-cluster-scoped-resources`
|
||||||
- `--include-cluster-scope-resources`
|
- `--include-cluster-scoped-resources`
|
||||||
- `--exclude-namespaced-resources`
|
- `--exclude-namespace-scoped-resources`
|
||||||
- `--include-namespaced-resources`
|
- `--include-namespace-scoped-resources`
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Namespaces to include. Default is `*`, all namespaces.
|
|||||||
|
|
||||||
### --include-resources
|
### --include-resources
|
||||||
|
|
||||||
Kubernetes resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use `*` for all resources). Cannot work with `--include-cluster-scope-resources`, `--exclude-cluster-scope-resources`, `--include-namespaced-resources` and `--exclude-namespaced-resources`.
|
Kubernetes resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use `*` for all resources). Cannot work with `--include-cluster-scoped-resources`, `--exclude-cluster-scoped-resources`, `--include-namespace-scoped-resources` and `--exclude-namespace-scoped-resources`.
|
||||||
|
|
||||||
* Backup all deployments in the cluster.
|
* Backup all deployments in the cluster.
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ Kubernetes resources to include in the backup, formatted as resource.group, such
|
|||||||
|
|
||||||
### --include-cluster-resources
|
### --include-cluster-resources
|
||||||
|
|
||||||
Includes cluster-scoped resources. Cannot work with `--include-cluster-scope-resources`, `--exclude-cluster-scope-resources`, `--include-namespaced-resources` and `--exclude-namespaced-resources`. This option can have three possible values:
|
Includes cluster-scoped resources. Cannot work with `--include-cluster-scoped-resources`, `--exclude-cluster-scoped-resources`, `--include-namespace-scoped-resources` and `--exclude-namespace-scoped-resources`. This option can have three possible values:
|
||||||
|
|
||||||
* `true`: all cluster-scoped resources are included.
|
* `true`: all cluster-scoped resources are included.
|
||||||
|
|
||||||
@@ -101,35 +101,35 @@ Includes cluster-scoped resources. Cannot work with `--include-cluster-scope-res
|
|||||||
|
|
||||||
For more information read the [Kubernetes label selector documentation](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors)
|
For more information read the [Kubernetes label selector documentation](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors)
|
||||||
|
|
||||||
### --include-cluster-scope-resources
|
### --include-cluster-scoped-resources
|
||||||
Kubernetes cluster-scoped resources to include in the backup, formatted as resource.group, such as `storageclasses.storage.k8s.io`(use '*' for all resources). Cannot work with `--include-resources`, `--exclude-resources` and `--include-cluster-resources`. This parameter only works for backup, not for restore.
|
Kubernetes cluster-scoped resources to include in the backup, formatted as resource.group, such as `storageclasses.storage.k8s.io`(use '*' for all resources). Cannot work with `--include-resources`, `--exclude-resources` and `--include-cluster-resources`. This parameter only works for backup, not for restore.
|
||||||
|
|
||||||
* Backup all StorageClasses and ClusterRoles in the cluster.
|
* Backup all StorageClasses and ClusterRoles in the cluster.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
velero backup create <backup-name> --include-cluster-scope-resources="storageclasses,clusterroles"
|
velero backup create <backup-name> --include-cluster-scoped-resources="storageclasses,clusterroles"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Backup all cluster-scoped resources in the cluster.
|
* Backup all cluster-scoped resources in the cluster.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
velero backup create <backup-name> --include-cluster-scope-resources="*"
|
velero backup create <backup-name> --include-cluster-scoped-resources="*"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### --include-namespaced-resources
|
### --include-namespace-scoped-resources
|
||||||
Kubernetes namespace resources to include in the backup, formatted as resource.group, such as `deployments.apps`(use '*' for all resources). Cannot work with `--include-resources`, `--exclude-resources` and `--include-cluster-resources`. This parameter only works for backup, not for restore.
|
Kubernetes namespace resources to include in the backup, formatted as resource.group, such as `deployments.apps`(use '*' for all resources). Cannot work with `--include-resources`, `--exclude-resources` and `--include-cluster-resources`. This parameter only works for backup, not for restore.
|
||||||
|
|
||||||
* Backup all Deployments and ConfigMaps in the cluster.
|
* Backup all Deployments and ConfigMaps in the cluster.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
velero backup create <backup-name> --include-namespaced-resources="deployments.apps,configmaps"
|
velero backup create <backup-name> --include-namespace-scoped-resources="deployments.apps,configmaps"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Backup all namespace resources in the cluster.
|
* Backup all namespace resources in the cluster.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
velero backup create <backup-name> --include-namespaced-resources="*"
|
velero backup create <backup-name> --include-namespace-scoped-resources="*"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Excludes
|
## Excludes
|
||||||
@@ -156,7 +156,7 @@ Namespaces to exclude.
|
|||||||
|
|
||||||
### --exclude-resources
|
### --exclude-resources
|
||||||
|
|
||||||
Kubernetes resources to exclude, formatted as resource.group, such as storageclasses.storage.k8s.io. Cannot work with `--include-cluster-scope-resources`, `--exclude-cluster-scope-resources`, `--include-namespaced-resources` and `--exclude-namespaced-resources`.
|
Kubernetes resources to exclude, formatted as resource.group, such as storageclasses.storage.k8s.io. Cannot work with `--include-cluster-scoped-resources`, `--exclude-cluster-scoped-resources`, `--include-namespace-scoped-resources` and `--exclude-namespace-scoped-resources`.
|
||||||
|
|
||||||
* Exclude secrets from the backup.
|
* Exclude secrets from the backup.
|
||||||
|
|
||||||
@@ -174,34 +174,34 @@ Kubernetes resources to exclude, formatted as resource.group, such as storagecla
|
|||||||
|
|
||||||
* Resources with the label `velero.io/exclude-from-backup=true` are not included in backup, even if it contains a matching selector label.
|
* Resources with the label `velero.io/exclude-from-backup=true` are not included in backup, even if it contains a matching selector label.
|
||||||
|
|
||||||
### --exclude-cluster-scope-resources
|
### --exclude-cluster-scoped-resources
|
||||||
Kubernetes cluster-scoped resources to exclude from the backup, formatted as resource.group, such as `storageclasses.storage.k8s.io`(use '*' for all resources). Cannot work with `--include-resources`, `--exclude-resources` and `--include-cluster-resources`. This parameter only works for backup, not for restore.
|
Kubernetes cluster-scoped resources to exclude from the backup, formatted as resource.group, such as `storageclasses.storage.k8s.io`(use '*' for all resources). Cannot work with `--include-resources`, `--exclude-resources` and `--include-cluster-resources`. This parameter only works for backup, not for restore.
|
||||||
|
|
||||||
* Exclude StorageClasses and ClusterRoles from the backup.
|
* Exclude StorageClasses and ClusterRoles from the backup.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
velero backup create <backup-name> --exclude-cluster-scope-resources="storageclasses,clusterroles"
|
velero backup create <backup-name> --exclude-cluster-scoped-resources="storageclasses,clusterroles"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Exclude all cluster-scoped resources from the backup.
|
* Exclude all cluster-scoped resources from the backup.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
velero backup create <backup-name> --exclude-cluster-scope-resources="*"
|
velero backup create <backup-name> --exclude-cluster-scoped-resources="*"
|
||||||
```
|
```
|
||||||
|
|
||||||
### --exclude-namespaced-resources
|
### --exclude-namespace-scoped-resources
|
||||||
Kubernetes namespace resources to exclude from the backup, formatted as resource.group, such as `deployments.apps`(use '*' for all resources). Cannot work with `--include-resources`, `--exclude-resources` and `--include-cluster-resources`. This parameter only works for backup, not for restore.
|
Kubernetes namespace resources to exclude from the backup, formatted as resource.group, such as `deployments.apps`(use '*' for all resources). Cannot work with `--include-resources`, `--exclude-resources` and `--include-cluster-resources`. This parameter only works for backup, not for restore.
|
||||||
|
|
||||||
* Exclude all Deployments and ConfigMaps from the backup.
|
* Exclude all Deployments and ConfigMaps from the backup.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
velero backup create <backup-name> --exclude-namespaced-resources="deployments.apps,configmaps"
|
velero backup create <backup-name> --exclude-namespace-scoped-resources="deployments.apps,configmaps"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Exclude all namespace resources from the backup.
|
* Exclude all namespace resources from the backup.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
velero backup create <backup-name> --exclude-namespaced-resources="*"
|
velero backup create <backup-name> --exclude-namespace-scoped-resources="*"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Resource policies
|
## Resource policies
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ Because of how Kubernetes handles Service objects of `type=LoadBalancer`, when y
|
|||||||
|
|
||||||
Alternatively, you might be able to use the Service's `spec.loadBalancerIP` field to keep connections valid, if your cloud provider supports this value. See [the Kubernetes documentation about Services of Type LoadBalancer](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer).
|
Alternatively, you might be able to use the Service's `spec.loadBalancerIP` field to keep connections valid, if your cloud provider supports this value. See [the Kubernetes documentation about Services of Type LoadBalancer](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer).
|
||||||
|
|
||||||
|
## Known issue with restoring resources when Admission webhooks are enabled
|
||||||
|
|
||||||
|
The [Admission webhooks](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/) may forbid a resource to be created based on the input, it may optionally mutate the input as well.
|
||||||
|
Because velero calls the API server to restore resources, it is possible that the admission webhooks are invoked and cause unexpected failures, depending on the implementation and the configuration of the webhooks.
|
||||||
|
To work around such issue, you may disable the webhooks or create a restore item action plugin to modify the resources before they are restored.
|
||||||
|
|
||||||
## Miscellaneous issues
|
## Miscellaneous issues
|
||||||
|
|
||||||
### Velero reports `custom resource not found` errors when starting up.
|
### Velero reports `custom resource not found` errors when starting up.
|
||||||
|
|||||||
58
site/content/docs/v1.11/_index.md
Normal file
58
site/content/docs/v1.11/_index.md
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
toc: "false"
|
||||||
|
cascade:
|
||||||
|
version: v1.11
|
||||||
|
toc: "true"
|
||||||
|
---
|
||||||
|
![100]
|
||||||
|
|
||||||
|
[![Build Status][1]][2]
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Velero (formerly Heptio Ark) gives you tools to back up and restore your Kubernetes cluster resources and persistent volumes. You can run Velero with a cloud provider or on-premises. Velero lets you:
|
||||||
|
|
||||||
|
* Take backups of your cluster and restore in case of loss.
|
||||||
|
* Migrate cluster resources to other clusters.
|
||||||
|
* Replicate your production cluster to development and testing clusters.
|
||||||
|
|
||||||
|
Velero consists of:
|
||||||
|
|
||||||
|
* A server that runs on your cluster
|
||||||
|
* A command-line client that runs locally
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
This site is our documentation home with installation instructions, plus information about customizing Velero for your needs, architecture, extending Velero, contributing to Velero and more.
|
||||||
|
|
||||||
|
Please use the version selector at the top of the site to ensure you are using the appropriate documentation for your version of Velero.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If you encounter issues, review the [troubleshooting docs][30], [file an issue][4], or talk to us on the [#velero-users channel][25] on the Kubernetes Slack server.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
If you are ready to jump in and test, add code, or help with documentation, follow the instructions on our [Start contributing](https://velero.io/docs/v1.11.0/start-contributing/) documentation for guidance on how to setup Velero for development.
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
See [the list of releases][6] to find out about feature changes.
|
||||||
|
|
||||||
|
[1]: https://github.com/vmware-tanzu/velero/workflows/Main%20CI/badge.svg
|
||||||
|
[2]: https://github.com/vmware-tanzu/velero/actions?query=workflow%3A"Main+CI"
|
||||||
|
|
||||||
|
[4]: https://github.com/vmware-tanzu/velero/issues
|
||||||
|
[6]: https://github.com/vmware-tanzu/velero/releases
|
||||||
|
|
||||||
|
[9]: https://kubernetes.io/docs/setup/
|
||||||
|
[10]: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-with-homebrew-on-macos
|
||||||
|
[11]: https://kubernetes.io/docs/tasks/tools/install-kubectl/#tabset-1
|
||||||
|
[12]: https://github.com/kubernetes/kubernetes/blob/main/cluster/addons/dns/README.md
|
||||||
|
[14]: https://github.com/kubernetes/kubernetes
|
||||||
|
[24]: https://groups.google.com/forum/#!forum/projectvelero
|
||||||
|
[25]: https://kubernetes.slack.com/messages/velero-users
|
||||||
|
|
||||||
|
[30]: troubleshooting.md
|
||||||
|
|
||||||
|
[100]: img/velero.png
|
||||||
21
site/content/docs/v1.11/api-types/README.md
Normal file
21
site/content/docs/v1.11/api-types/README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
title: "Table of Contents"
|
||||||
|
layout: docs
|
||||||
|
---
|
||||||
|
|
||||||
|
## API types
|
||||||
|
|
||||||
|
Here we list the API types that have some functionality that you can only configure via json/yaml vs the `velero` cli
|
||||||
|
(hooks)
|
||||||
|
|
||||||
|
* [Backup][1]
|
||||||
|
* [Restore][2]
|
||||||
|
* [Schedule][3]
|
||||||
|
* [BackupStorageLocation][4]
|
||||||
|
* [VolumeSnapshotLocation][5]
|
||||||
|
|
||||||
|
[1]: backup.md
|
||||||
|
[2]: restore.md
|
||||||
|
[3]: schedule.md
|
||||||
|
[4]: backupstoragelocation.md
|
||||||
|
[5]: volumesnapshotlocation.md
|
||||||
19
site/content/docs/v1.11/api-types/_index.md
Normal file
19
site/content/docs/v1.11/api-types/_index.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
layout: docs
|
||||||
|
title: API types
|
||||||
|
---
|
||||||
|
|
||||||
|
Here's a list the API types that have some functionality that you can only configure via json/yaml vs the `velero` cli
|
||||||
|
(hooks)
|
||||||
|
|
||||||
|
* [Backup][1]
|
||||||
|
* [Restore][2]
|
||||||
|
* [Schedule][3]
|
||||||
|
* [BackupStorageLocation][4]
|
||||||
|
* [VolumeSnapshotLocation][5]
|
||||||
|
|
||||||
|
[1]: backup.md
|
||||||
|
[2]: restore.md
|
||||||
|
[3]: schedule.md
|
||||||
|
[4]: backupstoragelocation.md
|
||||||
|
[5]: volumesnapshotlocation.md
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user