Preparing Red Hat OpenShift cluster to backup and restore the server data

You must prepare your OpenShift cluster before you back up or restore the data of HCL OneTest Server.

Before you begin

You must have installed OpenShift CLI. For more information, refer to the Getting started with the CLI section in the Red Hat OpenShift documentation.

About this task

Velero is one of the tools that are available to back up and restore the data of HCL OneTest Server that is installed on the Red Hat OpenShift platform. You must prepare your cluster before you back up or restore the data by using Velero. You can also use the other tools to back up and restore the data. If you use a different tool, then you must include the Persistent Volumes in the cluster.

Procedure

  1. Log in to the cluster by using oc login.
  2. Install and configure Velero with the Restic Integration.
  3. Set the name of the namespace in which HCL OneTest Server is installed by running the following command:
    NS=<namespace>
  4. Update stateful sets to apply the annotations required by Velero to back up the PVs used by the pods by running the following commands:
    for sts in $(oc get sts -n "$NS" -o name); do \
      if ! oc -n "$NS" patch --type=json "$sts" -p \
        '[{"op":"add","path":"/spec/template/metadata/annotations/backup.velero.io~1backup-volumes", "value":"data"}]' 2>/dev/null; then
          oc -n "$NS" patch --type=json "$sts" -p \
           '[{"op":"add","path":"/spec/template/metadata/annotations", "value":{"backup.velero.io/backup-volumes":"data"}}]'
      fi \
    done
  5. Change the security restriction of the pods by running the following commands:
    for sts in $(oc get sts -n "$NS" -oname); do \
      if oc get -n "$NS" "$sts" -ojsonpath='{.spec.template.spec.securityContext}' | grep -q "runAsNonRoot:true"; then \
        echo $sts
        oc patch -n "$NS" "$sts" --type json \
          -p '[{"op":"replace", "path":"/spec/template/spec/securityContext", "value": {"runAsNonRoot": false}}]'
      fi \
    done

Results

You have prepared your Red Hat OpenShift cluster to back up the server data.

What to do next

You can back up the server data. See Backing up the server data on Red Hat OpenShift.