Skip to content

Commit 55f0841

Browse files
Added docs covering VMinstance and VMDisk backups (#456)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Replaced the generic Kubernetes Backup and Recovery guide with a virtualization-focused Backup and Recovery doc covering VMInstance and VMDisk one‑off/scheduled backups, restores, status checks, examples, and troubleshooting (including Velero-related notes). * Updated backup configuration guidance to introduce separate VMInstance and VMDisk strategies, adjust example settings (selectors, TTLs, timeouts, storage parameters), and redirect workflow links to the new virtualization backup/restore documentation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 0bf8aa4 + f34f4ac commit 55f0841

3 files changed

Lines changed: 383 additions & 109 deletions

File tree

content/en/docs/v1/kubernetes/backup-and-recovery.md

Lines changed: 0 additions & 95 deletions
This file was deleted.

content/en/docs/v1/operations/services/velero-backup-configuration.md

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: "Configure backup storage, strategies, and BackupClasses for cluste
55
weight: 30
66
---
77

8-
This guide is for **cluster administrators** who configure the backup infrastructure in Cozystack: S3 storage, Velero locations, backup **strategies**, and **BackupClasses**. Tenant users then use existing BackupClasses to create [BackupJobs and Plans]({{% ref "/docs/v1/kubernetes/backup-and-recovery" %}}).
8+
This guide is for **cluster administrators** who configure the backup infrastructure in Cozystack: S3 storage, Velero locations, backup **strategies**, and **BackupClasses**. Tenant users then use existing BackupClasses to create [BackupJobs and Plans]({{% ref "/docs/v1/virtualization/backup-and-recovery" %}}).
99

1010
## Prerequisites
1111

@@ -119,42 +119,85 @@ kubectl get crd | grep -i backup
119119
kubectl explain <strategy-kind> --recursive
120120
```
121121

122-
Example strategy:
122+
Example strategy for VMInstance (includes all VM resources and attached volumes):
123123

124124
```yaml
125125
apiVersion: strategy.backups.cozystack.io/v1alpha1
126126
kind: Velero
127127
metadata:
128-
name: velero-backup-strategy
128+
name: vminstance-strategy
129129
spec:
130130
template:
131+
restoreSpec:
132+
existingResourcePolicy: update
133+
131134
spec: # see https://velero.io/docs/v1.17/api-types/backup/
132135
includedNamespaces:
133-
- '{{ .Application.metadata.namespace }}'
134-
135-
# Resources related VMInstance
136+
- '{{ .Application.metadata.namespace }}'
137+
orLabelSelectors:
138+
# VM resources (VirtualMachine, DataVolume, PVC, etc.)
139+
- matchLabels:
140+
app.kubernetes.io/instance: 'vm-instance-{{ .Application.metadata.name }}'
141+
# HelmRelease (the Cozystack app object)
142+
- matchLabels:
143+
apps.cozystack.io/application.kind: '{{ .Application.kind }}'
144+
apps.cozystack.io/application.name: '{{ .Application.metadata.name }}'
136145
includedResources:
137146
- helmreleases.helm.toolkit.fluxcd.io
138147
- virtualmachines.kubevirt.io
139148
- virtualmachineinstances.kubevirt.io
149+
- pods
140150
- datavolumes.cdi.kubevirt.io
141151
- persistentvolumeclaims
142-
- services
143152
- configmaps
144153
- secrets
145-
154+
- controllerrevisions.apps
155+
includeClusterResources: false
146156
storageLocation: '{{ .Parameters.backupStorageLocationName }}'
147-
148157
volumeSnapshotLocations:
149158
- '{{ .Parameters.backupStorageLocationName }}'
150159
snapshotVolumes: true
151160
snapshotMoveData: true
161+
ttl: 720h0m0s
162+
itemOperationTimeout: 24h0m0s
163+
```
164+
165+
Example strategy for VMDisk (disk and its volume only):
152166

167+
```yaml
168+
apiVersion: strategy.backups.cozystack.io/v1alpha1
169+
kind: Velero
170+
metadata:
171+
name: vmdisk-strategy
172+
spec:
173+
template:
174+
restoreSpec:
175+
existingResourcePolicy: update
176+
177+
spec:
178+
includedNamespaces:
179+
- '{{ .Application.metadata.namespace }}'
180+
orLabelSelectors:
181+
- matchLabels:
182+
app.kubernetes.io/instance: 'vm-disk-{{ .Application.metadata.name }}'
183+
- matchLabels:
184+
apps.cozystack.io/application.kind: '{{ .Application.kind }}'
185+
apps.cozystack.io/application.name: '{{ .Application.metadata.name }}'
186+
includedResources:
187+
- helmreleases.helm.toolkit.fluxcd.io
188+
- datavolumes.cdi.kubevirt.io
189+
- persistentvolumeclaims
190+
includeClusterResources: false
191+
storageLocation: '{{ .Parameters.backupStorageLocationName }}'
192+
volumeSnapshotLocations:
193+
- '{{ .Parameters.backupStorageLocationName }}'
194+
snapshotVolumes: true
195+
snapshotMoveData: true
153196
ttl: 720h0m0s
154197
itemOperationTimeout: 24h0m0s
155198
```
156199

157-
Template context for substitutions in template spec will be resolved according to defined Parameters in BackupClass and desired ApplicationRef defined in BackupJob / Plan.
200+
Template variables (`{{ .Application.* }}` and `{{ .Parameters.* }}`) are resolved from the ApplicationRef in the BackupJob/Plan and the parameters defined in the BackupClass.
158201

159202
Don't forget to apply it into management cluster:
160203

@@ -183,9 +226,19 @@ spec:
183226
- strategyRef:
184227
apiGroup: strategy.backups.cozystack.io
185228
kind: Velero
186-
name: velero-backup-strategy
229+
name: vminstance-strategy
187230
application:
188231
kind: VMInstance
232+
apiGroup: apps.cozystack.io
233+
parameters:
234+
backupStorageLocationName: default
235+
- strategyRef:
236+
apiGroup: strategy.backups.cozystack.io
237+
kind: Velero
238+
name: vmdisk-strategy
239+
application:
240+
kind: VMDisk
241+
apiGroup: apps.cozystack.io
189242
parameters:
190243
backupStorageLocationName: default
191244
```
@@ -201,8 +254,8 @@ kubectl get backupclasses
201254

202255
Once strategies and BackupClasses are in place, **tenant users** can run backups without touching Velero or storage configuration:
203256

204-
- **One-off backup**: create a [BackupJob]({{% ref "/docs/v1/kubernetes/backup-and-recovery#create-a-one-off-backup-backupjob" %}}) that references a BackupClass.
205-
- **Scheduled backups**: create a [Plan]({{% ref "/docs/v1/kubernetes/backup-and-recovery#create-scheduled-backups-plan" %}}) with a cron schedule and a BackupClass reference.
257+
- **One-off backup**: create a [BackupJob]({{% ref "/docs/v1/virtualization/backup-and-recovery#one-off-backup" %}}) that references a BackupClass.
258+
- **Scheduled backups**: create a [Plan]({{% ref "/docs/v1/virtualization/backup-and-recovery#scheduled-backup" %}}) with a cron schedule and a BackupClass reference.
206259

207260
Direct use of Velero CRDs (`Backup`, `Schedule`, `Restore`) remains available for advanced or recovery scenarios:
208261

@@ -228,4 +281,4 @@ kubectl logs -n cozy-velero -l app.kubernetes.io/name=velero --tail=100
228281

229282
## 5. Restore from a backup
230283

231-
For a description of restore procedures (including listing backups and checking restore progress), see [Restore from a backup (all resources)]({{% ref "/docs/v0/kubernetes/backup-and-recovery#3-restore-from-a-backup-all-resources" %}}).
284+
Once strategies and BackupClasses are in place, tenant users can restore from a backup using **RestoreJob** resources. See the [Backup and Recovery]({{% ref "/docs/v1/virtualization/backup-and-recovery" %}}) guide for restore instructions covering VMInstance and VMDisk in-place restores.

0 commit comments

Comments
 (0)