Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude PV and PVC in velero backups #1543

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/krp.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ The VRG enables Kubernetes resources to be captured(backed up) and recovered as
part of disaster protection. This is accomplished through the
kubeObjectProtection section of the VRG spec. If kubeObjectProtection is not
included in a VRG, then Kubernetes resources are not protected as part of the
VRG disaster protection.
VRG disaster protection. PVCs and PVs are protected by Ramen and all resources
are protected and backed by kubeObjectProtection.

The kubeObjectProtection section contains two sub-sections, captureOrder and
recoverOrder. This captureOrder section provides instructions on how to backup
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/kubeobjects/velero/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ func getBackupSpecFromObjectsSpec(objectsSpec kubeobjects.Spec) velero.BackupSpe
IncludedResources: objectsSpec.IncludedResources,
// exclude VRs from Backup so VRG can create them: see https://github.com/RamenDR/ramen/issues/884
ExcludedResources: append(objectsSpec.ExcludedResources, "volumereplications.replication.storage.openshift.io",
"replicationsources.volsync.backube", "replicationdestinations.volsync.backube"),
"replicationsources.volsync.backube", "replicationdestinations.volsync.backube",
"PersistentVolumeClaims", "PersistentVolumes"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may break user depending on velero backing up pvcs and pvs that ramen does not manage.

Option 1 (using the special velero lable) is little more work, but avoids this issue.
At the point we add and remove the ramen finalizer, we can also add the special velero label.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exclude and include resources here are per backup(esp. backup-name) and does not effect cluster wide. And our backups are uniquely named. So, ramen manages only this backup and not the others.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ramen backup is used by recipes that may want to backup other pvcs and pvs that ramen is not protecting. Using the label we can ensure that velero will not backup up or restore the pvs and pvcs we manage, without affecting other pvs and pvcs.

LabelSelector: objectsSpec.LabelSelector,
OrLabelSelectors: objectsSpec.OrLabelSelectors,
TTL: metav1.Duration{}, // TODO: set default here
Expand Down
Loading