Preparing IBM Red Hat OpenShift cluster to backup and restore DevOps Test Hub data

You must prepare your Red Hat OpenShift cluster before you back up or restore the data of IBM® DevOps Test Hub (Test Hub).

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

Velero is one of the tools that are available to back up and restore the data of Test Hub 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.

  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 Test Hub 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
You have prepared your Red Hat OpenShift cluster to back up the server data.
You can back up the server data. See Backing up DevOps Test Hub data on Red Hat OpenShift.