Skip to content

Commit 38fb9f6

Browse files
stuggiclaude
andcommitted
[b/r] Update backup README with ci-framework and manual procedure
Update automated Quick Start to use ci-framework playbooks. Add complete manual backup procedure with rendered Backup CRs for users not using ci-framework. Update customization variables table. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3e8d490 commit 38fb9f6

1 file changed

Lines changed: 80 additions & 61 deletions

File tree

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
# OpenStack Backup CRs
22

3-
This directory contains OADP Backup CR templates and playbook for backing up
4-
OpenStack environments.
5-
6-
The `templates/` directory contains Jinja2 templates for Velero Backup CRs.
7-
The backup playbook (`backup-openstack.yaml`) renders these templates with the
8-
appropriate variables and applies them in order, ensuring that what gets tested
9-
is exactly what gets documented.
3+
This document describes the OADP Backup CR strategy for backing up OpenStack
4+
environments. The backup playbooks and templates are in the
5+
[ci-framework](https://github.com/openstack-k8s-operators/ci-framework)
6+
`cifmw_backup_restore` role.
107

118
## Backup Approach
129

1310
We use a two-backup strategy:
1411

15-
1. **PVC backup** (`templates/backup-pvcs.yaml.j2`) — PVCs with CSI snapshots
12+
1. **PVC backup** — PVCs with CSI snapshots
1613
- Filters at backup time using `labelSelector`
1714
- Only includes PVCs labeled with `backup.openstack.org/backup: "true"`
1815
- Supports Data Mover (`snapshotMoveData: true`, default) to upload snapshot
1916
data to the BackupStorageLocation (S3/MinIO) via Kopia, enabling restore
2017
even after total cluster loss
2118

22-
2. **Resources backup** (`templates/backup-resources.yaml.j2`) — everything except PVCs
19+
2. **Resources backup** — everything except PVCs
2320
- Backs up all resources in the namespace
2421
- Excludes PVCs (backed up separately)
2522
- Includes: CRs, Secrets, ConfigMaps, NADs, etc.
@@ -43,12 +40,14 @@ We use a two-backup strategy:
4340

4441
## Quick Start
4542

46-
### Automated (Recommended)
47-
48-
Use the backup playbook to orchestrate the full backup flow:
43+
Use the ci-framework backup playbook (see [top-level README](../README.md)):
4944

5045
```bash
51-
ansible-playbook docs/dev/backup-restore/backup/backup-openstack.yaml
46+
ansible-playbook playbooks/backup_restore.yaml \
47+
-e cifmw_backup_restore_install_deps=false \
48+
-e cifmw_backup_restore_run_backup=true \
49+
-e cifmw_backup_restore_run_cleanup=false \
50+
-e cifmw_backup_restore_run_restore=false
5251
```
5352

5453
The playbook runs three steps:
@@ -58,34 +57,18 @@ The playbook runs three steps:
5857

5958
PVC backup labels are set automatically by service operators (glance-operator, mariadb-operator).
6059

61-
Override defaults with extra vars:
62-
```bash
63-
ansible-playbook docs/dev/backup-restore/backup/backup-openstack.yaml \
64-
-e openstack_namespace=openstack \
65-
-e storage_location=velero-1 \
66-
-e backup_ttl=168h
67-
68-
# Without Data Mover (local snapshots only):
69-
ansible-playbook docs/dev/backup-restore/backup/backup-openstack.yaml \
70-
-e snapshot_move_data=false
71-
72-
# Skip all confirmation prompts (non-interactive):
73-
ansible-playbook docs/dev/backup-restore/backup/backup-openstack.yaml \
74-
-e auto_ack=true
75-
```
60+
## Manual Backup Procedure
61+
62+
If you are not using the ci-framework playbooks, follow these steps manually.
7663

77-
### Manual
64+
### Step 1: Trigger Galera Database Dumps
7865

79-
The templates in `templates/` use Jinja2 variables. For manual backups,
80-
replace the variables with your values or render them with the playbook.
66+
Create backup jobs from the GaleraBackup cronjobs, passing a common timestamp
67+
so DB dump filenames match the OADP backup name:
8168

8269
```bash
83-
# Set a common timestamp for all backup artifacts
8470
BACKUP_TS=$(date +%Y%m%d-%H%M%S)
8571

86-
# 1. Trigger Galera database dumps (required before PVC backup)
87-
# Creates jobs from GaleraBackup cronjobs and passes the timestamp
88-
# so DB dump filenames match the backup name.
8972
for CRONJOB in $(oc get cronjob -n openstack -l app=galera -o jsonpath='{.items[*].metadata.name}'); do
9073
JOB_NAME="${CRONJOB}-${BACKUP_TS}"
9174
oc -n openstack create job --from=cronjob/${CRONJOB} ${JOB_NAME} \
@@ -96,19 +79,68 @@ done
9679

9780
# Wait for all backup jobs to complete
9881
oc -n openstack wait --for=condition=complete job -l app=galera --timeout=10m
82+
```
83+
84+
### Step 2: OADP PVC Backup (CSI Snapshots)
85+
86+
Create an OADP Backup CR for PVCs labeled with `backup.openstack.org/backup=true`:
87+
88+
```bash
89+
cat <<EOF | oc apply -f -
90+
apiVersion: velero.io/v1
91+
kind: Backup
92+
metadata:
93+
name: openstack-backup-pvcs-${BACKUP_TS}
94+
namespace: openshift-adp
95+
spec:
96+
includedNamespaces:
97+
- openstack
98+
labelSelector:
99+
matchLabels:
100+
backup.openstack.org/backup: "true"
101+
snapshotVolumes: true
102+
defaultVolumesToFsBackup: false
103+
snapshotMoveData: true
104+
volumeSnapshotLocations: []
105+
storageLocation: velero-1
106+
ttl: 720h
107+
EOF
108+
109+
oc wait --for=jsonpath='{.status.phase}'=Completed \
110+
backup/openstack-backup-pvcs-${BACKUP_TS} -n openshift-adp --timeout=30m
111+
```
112+
113+
Remove `snapshotMoveData: true` if you don't want to upload snapshots to
114+
the BackupStorageLocation (local CSI snapshots only).
115+
116+
### Step 3: OADP Resources Backup
99117

100-
# 2. OADP PVC backup (CSI snapshots of labeled PVCs)
101-
# See templates/backup-pvcs.yaml.j2 for the full template.
102-
# Render with: ansible -m template -a "src=templates/backup-pvcs.yaml.j2 dest=/tmp/backup-pvcs.yaml" localhost -e backup_name_suffix=${BACKUP_TS} ...
103-
oc apply -f /tmp/backup-pvcs.yaml
104-
oc wait --for=jsonpath='{.status.phase}'=Completed backup/openstack-backup-pvcs-${BACKUP_TS} -n openshift-adp --timeout=30m
118+
Create an OADP Backup CR for all resources except PVCs:
119+
120+
```bash
121+
cat <<EOF | oc apply -f -
122+
apiVersion: velero.io/v1
123+
kind: Backup
124+
metadata:
125+
name: openstack-backup-resources-${BACKUP_TS}
126+
namespace: openshift-adp
127+
spec:
128+
includedNamespaces:
129+
- openstack
130+
excludedResources:
131+
- persistentvolumeclaims
132+
- persistentvolumes
133+
storageLocation: velero-1
134+
ttl: 720h
135+
EOF
136+
137+
oc wait --for=jsonpath='{.status.phase}'=Completed \
138+
backup/openstack-backup-resources-${BACKUP_TS} -n openshift-adp --timeout=30m
139+
```
105140

106-
# 3. OADP resources backup
107-
# See templates/backup-resources.yaml.j2 for the full template.
108-
oc apply -f /tmp/backup-resources.yaml
109-
oc wait --for=jsonpath='{.status.phase}'=Completed backup/openstack-backup-resources-${BACKUP_TS} -n openshift-adp --timeout=30m
141+
### Step 4: Verify
110142

111-
# Check backup status
143+
```bash
112144
oc get backup -n openshift-adp -o custom-columns=NAME:.metadata.name,PHASE:.status.phase
113145
```
114146

@@ -127,19 +159,6 @@ ConfigMaps, NetworkAttachmentDefinitions, and any other namespace-scoped
127159
resources. Restore ordering is controlled by `backup.openstack.org/restore-order`
128160
labels on the backed-up resources (see `docs/dev/backup-restore/restore/README.md`).
129161

130-
## Customization
131-
132-
All templates accept variables for customization. Key variables:
133-
134-
| Variable | Default | Description |
135-
|----------|---------|-------------|
136-
| `openstack_namespace` | `openstack` | Target namespace |
137-
| `oadp_namespace` | `openshift-adp` | OADP namespace |
138-
| `storage_location` | `velero-1` | Velero storage location |
139-
| `backup_ttl` | `720h` | Backup retention (30 days) |
140-
| `snapshot_move_data` | `true` | Upload snapshots to BSL via Data Mover |
141-
| `auto_ack` | `false` | Skip confirmation prompts |
142-
143162
## Verification
144163

145164
```bash
@@ -171,6 +190,6 @@ oc logs -n openshift-adp -l name=node-agent --tail=50
171190

172191
## See Also
173192

174-
- Restore CRs: `docs/dev/backup-restore/restore/`
175-
- Implementation guide: `docs/dev/backup-restore/backup-restore-controller-implementation.md`
176-
- Design document: `docs/dev/backup-restore/backup-restore-controller-design.md`
193+
- Restore: [`../restore/README.md`](../restore/README.md)
194+
- Implementation guide: [`../backup-restore-controller-implementation.md`](../backup-restore-controller-implementation.md)
195+
- Design document: [`../backup-restore-controller-design.md`](../backup-restore-controller-design.md)

0 commit comments

Comments
 (0)