Skip to content

Commit 41ade8a

Browse files
committed
doc: Add documentation for backup feature
The DevWorkspaceOperatorConfig was extended to enable the workspace backup process. This commits describes the feature and how to configure it. Signed-off-by: Ales Raszka <[email protected]>
1 parent bcbaf1a commit 41ade8a

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

docs/dwo-configuration.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,88 @@ Cleanup CronJob configuration fields:
107107
- **`retainTime`**: The duration time in seconds since a DevWorkspace was last started before it is considered stale and eligible for cleanup. Default: 2592000 seconds (30 days).
108108
- **`dryRun`**: Set to `true` to run the cleanup job in dry-run mode. In this mode, the job logs which DevWorkspaces would be removed but does not actually delete them. Set to `false` to perform the actual deletion. Default: `false`.
109109

110+
## Configuring Backup CronJob
111+
112+
The DevWorkspace backup job allows for periodic backups of DevWorkspace data to a specified backup location.
113+
Once enabled and configured, the backup job will run at defined intervals to create backups of DevWorkspace data.
114+
The backup controller depends on OCI compatible registry that is used as an artifact storage for backup archives.
115+
116+
The backup makes a snapshoft of Workspace PVCs and stores them as tar.gz archives in the specified OCI registry.
117+
**Note:** By default, the DevWorkspace backup job is disabled.
118+
119+
There are several configuration options to customize the logic:
120+
121+
### Integrated OpenShift container registry
122+
This option is available only on OpenShift clusters with integrated container registry enabled and requires no additional configuration.
123+
124+
To enable the backup use following configuration in the global DWOC:
125+
126+
```yaml
127+
apiVersion: controller.devfile.io/v1alpha1
128+
kind: DevWorkspaceOperatorConfig
129+
config:
130+
routing:
131+
defaultRoutingClass: basic
132+
workspace:
133+
backupCronJob:
134+
enable: true
135+
registry:
136+
path: default-route-openshift-image-registry.apps.{cluster ID}.openshiftapps.com
137+
schedule: '0 */4 * * *' # cron expression with backup frequency
138+
imagePullPolicy: Always
139+
```
140+
141+
**Note:** The `path` field must contain the URL to your OpenShift integrated registry given by the cluster.
142+
143+
Once the backup job is finished the backup archives will be available in the DevWorkspace namespace under a repository
144+
with matching Devworkspace name.
145+
146+
### Regular OCI compatible registry
147+
To use a regular OCI compatible registry for backups, you need to provide registry credentials. Depending on your
148+
RBAC policy the token can be provided via a secret in the operator namespace or in each DevWorkspace namespace.
149+
Having the secret in the DevWorkspace namespace allows for using different registry accounts per namespace with more
150+
granular access controll.
151+
152+
153+
```yaml
154+
kind: DevWorkspaceOperatorConfig
155+
apiVersion: controller.devfile.io/v1alpha1
156+
config:
157+
routing:
158+
defaultRoutingClass: basic
159+
workspace:
160+
backupCronJob:
161+
enable: true
162+
registry:
163+
authSecret: my-secret
164+
path: quay.io/my-company-org
165+
schedule: '0 */4 * * *'
166+
imagePullPolicy: Always
167+
```
168+
The `authSecret` must point to real Kubernetes Secret of type `kubernetes.io/dockerconfigjson` containing credentials to access the registry.
169+
170+
To create one you can use following command:
171+
172+
```bash
173+
kubectl create secret docker-registry my-secret --from-file=config.json -n devworkspace-controller
174+
```
175+
The secret must contain a label `controller.devfile.io/watch-secret=true` to be recognized by the DevWorkspace Operator.
176+
```bash
177+
kubectl label secret my-secret controller.devfile.io/watch-secret=true -n devworkspace-controller
178+
```
179+
180+
### Restore from backup
181+
We are aiming to provide automated restore functionality in future releases. But for now you can still
182+
manually restore the data from the backup archives created by the backup job.
183+
184+
Since the backup archive is available in OCI registry you can use any OCI compatible tool to pull
185+
the archive locally. For example using [oras](https://github.com/oras-project/oras) cli tool:
186+
187+
```bash
188+
oras pull <registry-path>/<devworkspace-name>:latest
189+
```
190+
The archive will be downloaded as a `devworkspace-backup.tar.gz` file which you can extract and restore the data.
191+
110192
## Configuring PVC storage access mode
111193

112194
By default, PVCs managed by the DevWorkspace Operator are created with the `ReadWriteOnce` access mode.

0 commit comments

Comments
 (0)