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
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
- Log in to the cluster by using oc login.
- Install and configure Velero with the Restic Integration.
-
Set the name of the namespace in which HCL OneTest™ Server is installed by running the following command:
NS=<namespace>
-
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
-
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