Backing up and restoring the user data on Red Hat OpenShift

To secure the user data in IBM® Rational® Test Automation Server that is installed on the OpenShift server, you can back up the user data. At any point in time, after you install IBM® Rational® Test Automation Server, you can restore the backed-up user data.

Before you begin

You must have been granted access to the cluster.

About this task

This topic provides you with an example of backing up and restoring the user data by using Velero. Velero is one of the methods for backing up and restoring the user data. You can also use other methods for backing up and restoring the user data. If you use a different method to back up, then you must include the Persistent Volumes in the cluster. For more information about the Persistent Volumes, see Persistent Volumes.

Preparing your cluster to backup and restore the user data

You must prepare your cluster before you back up or restore the user data in Rational® Test Automation Server.

Procedure

  1. Log in to the cluster by using oc login.
  2. Install and configure Velero with the Restic Integration. For more details, refer to the Velero portal.
  3. Set the name of the namespace in which Rational® Test Automation Server is installed by entering 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 entering 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 entering 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

Backing up the user data

You can back up the user data by using Velero.

Before you begin

You must follow the steps in the Preparing your cluster to backup and restore the user data section.

About this task

This procedure is an example of backing up the user data by using Velero.

Procedure

  1. Log in to the cluster by using oc login.
  2. Start the backup process by entering the following commands:
    velero backup create <backup-name> --include-namespaces=<ibm-rtas-namespace>

Restoring the user data

If you want to restore the Velero backup on to a cluster in which Rational® Test Automation Server is not installed, you can restore by using Velero.

Before you begin

You must have backed up the user data. For more information, see Backing up the user data section.

Procedure

  1. Log in to the cluster by using oc login.
  2. Start the restore process by entering the following command:.
    velero restore create --from-backup=<backup-name> --restore-volumes