@@ -198,26 +198,56 @@ metadata:
198198spec:
199199 includedNamespaces:
200200 - openstack
201- # NO labelSelector - backup everything
202- snapshotVolumes: true # Backup PVCs with CSI snapshots
201+ # NO labelSelector - backup all CRs, Secrets, ConfigMaps
202+ # PVC snapshots are filtered by the openstack.org/backup label (see note below)
203+ snapshotVolumes: true # Enable CSI snapshots for PVCs
203204 defaultVolumesToFsBackup: false
204205 storageLocation: velero-1
205206 ttl: 720h
206207` ` `
207208
208- **Optional: Exclude large PVC data** (if storage is limited):
209+ **Note on PVC Backup:**
210+ - All CRs, Secrets, and ConfigMaps in the namespace are backed up (no label filtering)
211+ - **PVCs are selectively backed up** using the `openstack.org/backup: "true"` label
212+ - OADP's CSI snapshot logic respects the backup label when creating volume snapshots
213+ - Individual PVCs can be excluded using annotation : ` backup.velero.io/backup-volumes: "false"`
214+
215+ See [PVC Labeling Strategy](#pvc-labeling-strategy) for details on how PVCs are labeled for backup.
216+
217+ **Alternative: Split Backup into CRs and PVCs** (if you want explicit separation):
209218
210219` ` ` yaml
220+ # Backup 1: All CRs and core resources (no PVCs)
211221apiVersion: velero.io/v1
212222kind: Backup
213223metadata:
214- name: openstack-backup -20260303-120000
224+ name: openstack-crs -20260303-120000
215225 namespace: openshift-adp
216226spec:
217227 includedNamespaces:
218228 - openstack
219- # Backup all CRs, Secrets, ConfigMaps, but exclude PVC data
220- snapshotVolumes: false # Skip PVC snapshots to reduce backup size
229+ excludedResources:
230+ - persistentvolumeclaims
231+ - persistentvolumes
232+ snapshotVolumes: false
233+ storageLocation: velero-1
234+ ttl: 720h
235+ ---
236+ # Backup 2: Only labeled PVCs with CSI snapshots
237+ apiVersion: velero.io/v1
238+ kind: Backup
239+ metadata:
240+ name: openstack-pvcs-20260303-120000
241+ namespace: openshift-adp
242+ spec:
243+ includedNamespaces:
244+ - openstack
245+ includedResources:
246+ - persistentvolumeclaims
247+ labelSelector:
248+ matchLabels:
249+ openstack.org/backup: "true"
250+ snapshotVolumes: true
221251 defaultVolumesToFsBackup: false
222252 storageLocation: velero-1
223253 ttl: 720h
@@ -422,7 +452,97 @@ The restore sequence is critical for maintaining dependencies between resources.
422452| PersistentVolumeClaim** | true | all | 8 | Service storage volumes |
423453
424454*Only resources without ownerReferences
425- **Only PVCs with label ` openstack.org/backup-restore: "true"`
455+ **PVCs use dual-label approach (see PVC Labeling Strategy below)
456+
457+ ### PVC Labeling Strategy
458+
459+ PVCs use a **dual-label approach** to separate backup inclusion from restore inclusion:
460+
461+ **Label Purposes:**
462+ - **` openstack.org/backup: "true"`** - Include PVC in backup snapshot (required for CSI snapshot)
463+ - **`openstack.org/backup-restore: "true"`** - Include PVC in restore operation (optional)
464+
465+ **Common Scenarios:**
466+
467+ 1. **Production data (backup AND restore)** - Most PVCs :
468+ ` ` ` yaml
469+ metadata:
470+ labels:
471+ openstack.org/backup: "true" # Snapshot during backup
472+ openstack.org/backup-restore: "true" # Restore during restore
473+ openstack.org/backup-restore-order: "8"
474+ annotations:
475+ service: glance
476+ ` ` `
477+ Examples : Glance images, Cinder volumes, Manila shares, Galera backup dumps
478+
479+ 2. **Backup-only data (backup but NOT restore)** - Logs, temporary data :
480+ ` ` ` yaml
481+ metadata:
482+ labels:
483+ openstack.org/backup: "true" # Snapshot during backup
484+ # NO backup-restore label → excluded from restore
485+ annotations:
486+ service: logging
487+ ` ` `
488+ Examples : Log aggregation PVCs, audit logs, test data
489+
490+ Use case : Backup for audit/compliance, but don't restore old logs to new environment
491+
492+ 3. **Skip backup entirely** - Caches, ephemeral data :
493+ ` ` ` yaml
494+ metadata:
495+ labels:
496+ # NO backup label
497+ annotations:
498+ backup.velero.io/backup-volumes: "false" # Explicitly skip even if labeled
499+ service: memcached
500+ ` ` `
501+ Examples : Cache storage, temporary workspaces
502+
503+ **How Labels Are Used:**
504+
505+ **Backup CR** - Uses `openstack.org/backup` label selector:
506+ ` ` ` yaml
507+ apiVersion: velero.io/v1
508+ kind: Backup
509+ spec:
510+ includedNamespaces:
511+ - openstack
512+ labelSelector:
513+ matchLabels:
514+ openstack.org/backup: "true" # Only PVCs with backup label
515+ snapshotVolumes: true
516+ ` ` `
517+
518+ **Restore CR** - Uses `openstack.org/backup-restore` label selector:
519+ ` ` ` yaml
520+ apiVersion: velero.io/v1
521+ kind: Restore
522+ spec:
523+ labelSelector:
524+ matchLabels:
525+ openstack.org/backup-restore: "true"
526+ openstack.org/backup-restore-order: "8"
527+ restorePVs: true
528+ ` ` `
529+
530+ **Excluding Individual PVCs:**
531+
532+ If a PVC has `openstack.org/backup : " true" ` but should be skipped, add Velero's annotation:
533+ ` ` ` yaml
534+ metadata :
535+ labels :
536+ openstack.org/backup : " true"
537+ annotations :
538+ backup.velero.io/backup-volumes : " false" # Override: skip this PVC
539+ ` ` `
540+
541+ **Who Sets These Labels:**
542+
543+ - Service operators add ` openstack.org/backup: "true"` when creating PVCs that need backup
544+ - Webhook (or operator) adds `openstack.org/backup-restore : " true" ` + order to PVCs that should restore
545+ - Manual override via ` backup.velero.io/backup-volumes: "false"` annotation when needed
426546
427547# # Backup Categories
428548
@@ -749,24 +869,19 @@ status:
749869 - Automated mode : Controller execs into pods
750870 - Manual mode : User runs commands
751871
752- 4. **PVC Labeling** : How do PVCs get the backup label?
753- - Service operators add label when creating PVCs?
754- - Separate webhook for PVCs?
755- - Manual labeling required?
756-
757- 5. **Webhook Scope** : Should webhook run in openstack-operator or separate deployment?
872+ 4. **Webhook Scope** : Should webhook run in openstack-operator or separate deployment?
758873 - openstack-operator : Simpler deployment (reuse existing webhooks)
759874 - Separate : Cleaner separation of concerns
760875
761- 6 . **OpenStackBackupConfig Scope** : Should the config CR be namespace-scoped or cluster-scoped?
876+ 5 . **OpenStackBackupConfig Scope** : Should the config CR be namespace-scoped or cluster-scoped?
762877 - Namespace-scoped : Different configs per OpenStack deployment
763878 - Cluster-scoped : Single config for all OpenStack deployments
764879
765- 7 . **Default vs Custom Order Precedence** : How should the order precedence work?
880+ 6 . **Default vs Custom Order Precedence** : How should the order precedence work?
766881 - Current proposal : Manual labels > OpenStackBackupConfig > Hardcoded defaults
767882 - Alternative : OpenStackBackupConfig > Manual labels > Hardcoded defaults
768883
769- 8 . **Webhook Update Logic** : Should webhook update resources on every reconcile?
884+ 7 . **Webhook Update Logic** : Should webhook update resources on every reconcile?
770885 - Only on Create : Simpler, but doesn't handle label removal
771886 - On Create and Update : Handles label changes, but more update operations
772887 - Current proposal : On Create and Update (ValidateCreate + ValidateUpdate)
0 commit comments