このコンテンツは選択した言語では利用できません。
Chapter 18. Back up OpenShift Dev Spaces workspaces
Back up OpenShift Dev Spaces workspace data to an OCI-compatible registry on a recurring schedule.
The Dev Workspace backup controller creates periodic snapshots of stopped workspace PVCs and stores them as tar.gz archives in a target registry. Supported registries include the OpenShift Container Platform integrated registry and Quay.io. Configure the backup schedule, target registry, and authentication by editing the DevWorkspaceOperatorConfig resource.
The backoffLimit field sets the number of retries before marking the backup job as failed. The default value is 1.
By default, the Dev Workspace backup job is disabled.
18.1. Configure backup with the integrated OpenShift registry リンクのコピーリンクがクリップボードにコピーされました!
Configure the Dev Workspace backup job to use the integrated OpenShift Container Platform container registry. This option requires no additional authentication configuration.
Prerequisites
- You have administrator access to the OpenShift cluster.
- You have the integrated container registry enabled on the cluster.
Procedure
Configure the
DevWorkspaceOperatorConfigresource to enable the backup job:apiVersion: controller.devfile.io/v1alpha1 kind: DevWorkspaceOperatorConfig metadata: name: devworkspace-operator-config namespace: openshift-operators config: workspace: backupCronJob: enable: true registry: path: <integrated_registry_url> oras: extraArgs: '--insecure' schedule: '0 */4 * * *' imagePullPolicy: Alwayswhere:
openshift-operators- The default installation namespace for the Dev Workspace Operator on OpenShift. If the Dev Workspace Operator is installed in a different namespace, use that namespace instead.
<integrated_registry_url>- The URL to the OpenShift Container Platform integrated registry for your cluster.
--insecure-
The
--insecureflag may be required depending on the integrated registry’s routing configuration.
Get the default path to the integrated registry:
echo "$(oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}')"
Verification
- After the backup job completes, verify that the backup archives are available in the integrated registry. Check the Dev Workspace project for a repository with a matching Dev Workspace name.
If the installation project for the Dev Workspace Operator is not openshift-operators, you must define it as an environment variable for the Red Hat OpenShift Dev Spaces dashboard in the CheCluster Custom Resource.
apiVersion: org.eclipse.che/v2
kind: CheCluster
spec:
components:
dashboard:
deployment:
containers:
- env:
- name: DWO_NAMESPACE
value: <operator_install_namespace>
name: che-dashboard
+ where:
+ <operator_install_namespace>:: The project where the Dev Workspace Operator is installed. The default installation project for the Dev Workspace Operator on OpenShift is openshift-operators.
For more information, see Section 2.3.3, “Dev Workspace operator”.
18.2. Configure backup with a regular OCI-compatible registry リンクのコピーリンクがクリップボードにコピーされました!
Configure the Dev Workspace backup job to use a regular OCI-compatible registry for backups. Provide registry credentials through a Kubernetes Secret in the Operator project or in each Dev Workspace project.
A Secret in the Dev Workspace project enables using different registry accounts per project with more granular access control.
Prerequisites
- You have administrator access to the OpenShift cluster.
- You have credentials for an OCI-compatible registry such as Quay.io.
Procedure
Configure the
DevWorkspaceOperatorConfigresource to enable the backup job:kind: DevWorkspaceOperatorConfig apiVersion: controller.devfile.io/v1alpha1 metadata: name: devworkspace-operator-config namespace: openshift-operators config: workspace: backupCronJob: enable: true registry: authSecret: devworkspace-backup-registry-auth path: <registry_url> schedule: '0 */4 * * *' imagePullPolicy: Alwayswhere:
openshift-operators- The default installation namespace for the Dev Workspace Operator on OpenShift. If the Dev Workspace Operator is installed in a different namespace, use that namespace instead.
<registry_url>The OCI registry URL. For example:
quay.io/my-company-org.The
authSecretmust be nameddevworkspace-backup-registry-auth. It must reference a Kubernetes Secret of typekubernetes.io/dockerconfigjsonthat contains credentials to access the registry. Create the Secret in the installation project for the Dev Workspace Operator.
Create the registry credentials Secret:
oc create secret docker-registry devworkspace-backup-registry-auth --from-file=config.json -n openshift-operatorsAdd the required label to the Secret for the Dev Workspace Operator to recognize it:
oc label secret devworkspace-backup-registry-auth controller.devfile.io/watch-secret=true -n openshift-operatorsWarningThe Dev Workspace Operator copies the
devworkspace-backup-registry-authSecret to each Dev Workspace project so that backups from user workspaces can be pushed to the registry. To use different credentials per project, create adevworkspace-backup-registry-authSecret with user-specific credentials in each Dev Workspace project instead.
Verification
- After the backup job completes, verify that the backup archives are available in the OCI registry under the expected path.
If the installation project for the Dev Workspace Operator is not openshift-operators, you must define it as an environment variable for the Red Hat OpenShift Dev Spaces dashboard in the CheCluster Custom Resource.
apiVersion: org.eclipse.che/v2
kind: CheCluster
spec:
components:
dashboard:
deployment:
containers:
- env:
- name: DWO_NAMESPACE
value: <operator_install_namespace>
name: che-dashboard
+ where:
+ <operator_install_namespace>:: The project where the Dev Workspace Operator is installed. The default installation project for the Dev Workspace Operator on OpenShift is openshift-operators.
For more information, see Section 2.3.3, “Dev Workspace operator”.