Skip to content

Commit 1e8ba09

Browse files
stuggiclaude
andcommitted
Remove openstack.org/backup annotation from CRDs
Remove the `openstack.org/backup` annotation from CRD specifications since OADP Backup CR uses full namespace backup without label selector. All CRs are backed up regardless of annotations, making the backup annotation unnecessary for CRDs. Key changes: - Remove backup annotation from CRD examples and definitions - Update CRD annotation mapping tables (remove Backup column) - Clarify that all CRs are backed up via full namespace backup - Maintain selective restore using only backup-restore annotation - PVCs still use dual-label approach (backup + backup-restore labels) This simplifies the design to "full backup, selective restore" for CRs while PVCs remain an exception with selective backup and restore. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 159bfd6 commit 1e8ba09

1 file changed

Lines changed: 42 additions & 52 deletions

File tree

docs/dev/backup-restore-webhook-design.md

Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,14 @@ This document describes a webhook-based approach to backup and restore for OpenS
2121

2222
### CRD Annotations
2323

24-
CRD definitions use a **dual-annotation strategy** to separate backup inclusion from restore inclusion (all prefixed with `openstack.org/backup-`):
24+
CRD definitions use **restore annotations** to control which instances should be restored (all prefixed with `openstack.org/backup-`):
2525

2626
```yaml
2727
apiVersion: apiextensions.k8s.io/v1
2828
kind: CustomResourceDefinition
2929
metadata:
3030
name: openstackcontrolplanes.core.openstack.org
3131
annotations:
32-
# Backup annotation (inclusive - defaults to true if missing)
33-
openstack.org/backup: "true"
34-
3532
# Restore annotations (explicit opt-in - must be present to restore)
3633
openstack.org/backup-restore: "true"
3734
openstack.org/backup-category: "controlplane"
@@ -40,11 +37,6 @@ metadata:
4037
4138
**Annotations:**
4239
43-
- `openstack.org/backup`: Whether instances of this CRD should be included in backup
44-
- **Default if missing**: `"true"` (inclusive - backup everything for safety)
45-
- `"true"`: Explicitly include in backup
46-
- `"false"`: Explicitly exclude from backup
47-
4840
- `openstack.org/backup-restore`: Whether instances of this CRD should be restored
4941
- **Default if missing**: `"false"` (explicit opt-in required - only restore what's needed)
5042
- `"true"`: Include in restore (webhook adds restore labels to instances)
@@ -56,12 +48,11 @@ metadata:
5648

5749
- `openstack.org/backup-restore-order`: Numeric order for restore sequence (e.g., `"1"`, `"2"`, `"3"`)
5850

59-
**Dual-Annotation Strategy:**
51+
**Restore Strategy:**
6052

61-
This mirrors the PVC dual-label approach and provides:
62-
- ✅ **Safe backups**: Everything backed up by default (complete snapshot)
63-
- ✅ **Controlled restores**: Only explicitly marked CRDs get restored
64-
- ✅ **Clear intent**: Easy to see what's backed up vs restored
53+
- ✅ **Full backup**: All CRs backed up by OADP (no label selector on Backup CR)
54+
- ✅ **Selective restore**: Only CRs with `openstack.org/backup-restore: "true"` annotation are restored
55+
- ✅ **Clear intent**: CRD annotations declare what needs restoration
6556

6657
**Examples:**
6758

@@ -72,16 +63,15 @@ kind: CustomResourceDefinition
7263
metadata:
7364
name: openstackdataplanedeployments.dataplane.openstack.org
7465
annotations:
75-
openstack.org/backup: "true" # Include in backup
7666
# NO backup-restore annotation # Don't restore (default: false)
67+
# All instances still backed up (full namespace backup)
7768
7869
# OpenStackControlPlane - backup AND restore
7970
apiVersion: apiextensions.k8s.io/v1
8071
kind: CustomResourceDefinition
8172
metadata:
8273
name: openstackcontrolplanes.core.openstack.org
8374
annotations:
84-
openstack.org/backup: "true" # Include in backup
8575
openstack.org/backup-restore: "true" # Include in restore
8676
openstack.org/backup-category: "controlplane"
8777
openstack.org/backup-restore-order: "6"
@@ -426,8 +416,7 @@ spec:
426416
427417
**Why backup ALL CRs/Secrets/ConfigMaps?**
428418
- Ensures complete snapshot (nothing missed)
429-
- CRD `openstack.org/backup` annotation **defaults to true** if missing (inclusive)
430-
- Simple backup logic (no complex filtering)
419+
- Simple backup logic (no label selector on OADP Backup CR)
431420
- Restore is selective via webhook labels (see below - only resources with `backup-restore: "true"` labels are restored)
432421
- Examples of backed up but not restored: DataPlaneDeployment, operator-managed Secrets/ConfigMaps
433422

@@ -721,41 +710,42 @@ The restore sequence is critical for maintaining dependencies between resources.
721710
This section shows the annotations that should be added to each CRD definition.
722711
723712
**Column definitions:**
724-
- **Backup**: `openstack.org/backup` annotation value (true = include in backup, defaults to true if missing)
725713
- **Restore**: `openstack.org/backup-restore` annotation value (true = webhook labels instances for restore, defaults to false if missing)
726714
- **Category**: `openstack.org/backup-category` annotation value
727715
- **Order**: `openstack.org/backup-restore-order` annotation value
728716

717+
**Note:** All CRs are backed up via full namespace backup (OADP Backup CR has no label selector). Only CRs with `backup-restore: true` annotation are restored.
718+
729719
### Core Operator CRDs
730720

731-
| CRD | Backup | Restore | Category | Order | Notes |
732-
|-----|--------|---------|----------|-------|-------|
733-
| OpenStackControlPlane | true | true | controlplane | 6 | Main control plane CR |
734-
| OpenStackVersion | true | true | controlplane | 5 | Version tracking |
721+
| CRD | Restore | Category | Order | Notes |
722+
|-----|---------|----------|-------|-------|
723+
| OpenStackControlPlane | true | controlplane | 6 | Main control plane CR |
724+
| OpenStackVersion | true | controlplane | 5 | Version tracking |
735725

736726
### Infrastructure Operator CRDs
737727

738-
| CRD | Backup | Restore | Category | Order | Notes |
739-
|-----|--------|---------|----------|-------|-------|
740-
| NetConfig | true | true | dataplane | 5 | Network topology (required first) |
741-
| Topology | true | true | dataplane | 5 | Network topology |
742-
| BGPConfiguration | true | true | dataplane | 5 | BGP config |
743-
| DNSData | true | true | dataplane | 5 | DNS records |
744-
| Reservation | true | true | dataplane | 6 | IP reservations (requires NetConfig) |
745-
| IPSet | true | true | dataplane | 7 | IP address sets (requires NetConfig) |
746-
| InstanceHa | true | true | controlplane | 5 | Instance HA config |
747-
| RabbitMQUser* | true | true | controlplane | 7 | User-created only |
748-
| RabbitMQVhost* | true | true | controlplane | 7 | User-created only |
728+
| CRD | Restore | Category | Order | Notes |
729+
|-----|---------|----------|-------|-------|
730+
| NetConfig | true | dataplane | 5 | Network topology (required first) |
731+
| Topology | true | dataplane | 5 | Network topology |
732+
| BGPConfiguration | true | dataplane | 5 | BGP config |
733+
| DNSData | true | dataplane | 5 | DNS records |
734+
| Reservation | true | dataplane | 6 | IP reservations (requires NetConfig) |
735+
| IPSet | true | dataplane | 7 | IP address sets (requires NetConfig) |
736+
| InstanceHa | true | controlplane | 5 | Instance HA config |
737+
| RabbitMQUser* | true | controlplane | 7 | User-created only |
738+
| RabbitMQVhost* | true | controlplane | 7 | User-created only |
749739

750740
*Only for user-created resources (no ownerReferences)
751741

752742
### MariaDB Operator CRDs
753743

754-
| CRD | Backup | Restore | Category | Order | Notes |
755-
|-----|--------|---------|----------|-------|-------|
756-
| MariaDBDatabase | true | true | controlplane | 3 | Database definitions |
757-
| MariaDBAccount | true | true | controlplane | 4 | Database accounts (references password secret) |
758-
| GaleraBackup | true | true | controlplane | 9 | Backup configuration |
744+
| CRD | Restore | Category | Order | Notes |
745+
|-----|---------|----------|-------|-------|
746+
| MariaDBDatabase | true | controlplane | 3 | Database definitions |
747+
| MariaDBAccount | true | controlplane | 4 | Database accounts (references password secret) |
748+
| GaleraBackup | true | controlplane | 9 | Backup configuration |
759749

760750
**Important:** mariadb-operator must label password secrets when creating them:
761751
```go
@@ -784,11 +774,11 @@ secret := &corev1.Secret{
784774

785775
### Data Plane CRDs
786776

787-
| CRD | Backup | Restore | Category | Order | Notes |
788-
|-----|--------|---------|----------|-------|-------|
789-
| OpenStackDataPlaneService* | true | true | dataplane | 8 | Custom services (before NodeSets) |
790-
| OpenStackDataPlaneNodeSet | true | true | dataplane | 9 | Node set definitions (requires IPSets/Reservations) |
791-
| OpenStackDataPlaneDeployment | true | false** | - | - | Backup for reference, never restore (ephemeral) |
777+
| CRD | Restore | Category | Order | Notes |
778+
|-----|---------|----------|-------|-------|
779+
| OpenStackDataPlaneService* | true | dataplane | 8 | Custom services (before NodeSets) |
780+
| OpenStackDataPlaneNodeSet | true | dataplane | 9 | Node set definitions (requires IPSets/Reservations) |
781+
| OpenStackDataPlaneDeployment | false** | - | - | Backed up for reference, never restored (ephemeral) |
792782

793783
*Only for user-created services (no ownerReferences)
794784
**No `backup-restore` annotation = defaults to false (not restored)
@@ -836,16 +826,16 @@ labelSelector:
836826

837827
**Note:** These are not OpenStack CRDs, so they don't have CRD annotations. Instead, webhooks/operators add labels directly to resource instances.
838828

839-
| Resource | Backup | Restore | Category | Order | Notes |
840-
|----------|--------|---------|----------|-------|-------|
841-
| Secret* | all | user-only | controlplane | 1 | All backed up; only user-provided restored (no ownerReferences) |
842-
| ConfigMap* | all | user-only | controlplane | 1 | All backed up; only user-provided restored (no ownerReferences) |
843-
| NetworkAttachmentDefinition | all | all | controlplane | 1 | Network attachments (all backed up and restored) |
844-
| Issuer (cert-manager) | all | all | controlplane | 2 | TLS issuers (operator adds labels, includes custom Issuers) |
845-
| PersistentVolumeClaim** | labeled-only | labeled-only | controlplane | 8 | Only labeled PVCs backed up and restored |
829+
| Resource | Restore | Category | Order | Notes |
830+
|----------|---------|----------|-------|-------|
831+
| Secret* | user-only | controlplane | 1 | All backed up; only user-provided restored (no ownerReferences) |
832+
| ConfigMap* | user-only | controlplane | 1 | All backed up; only user-provided restored (no ownerReferences) |
833+
| NetworkAttachmentDefinition | all | controlplane | 1 | All backed up and restored |
834+
| Issuer (cert-manager) | all | controlplane | 2 | All backed up; operator adds labels to all for restore |
835+
| PersistentVolumeClaim** | labeled-only | controlplane | 8 | Only labeled PVCs backed up and restored (exception to full backup) |
846836

847837
*All Secrets/ConfigMaps included in full namespace backup; webhook only labels user-provided ones (no ownerReferences) for restore
848-
**PVCs use dual-label approach (see PVC Labeling Strategy below)
838+
**PVCs use dual-label approach and selective backup (see PVC Labeling Strategy below)
849839

850840
### PVC Labeling Strategy
851841

0 commit comments

Comments
 (0)