Skip to content

Purpose of this repo is to demo an example of Red Hat Openshift API for Data Protection/OADP(Velero) with Red Hat Advanced Cluster Management(ACM) running on OpenShift.S3 Storage for this example is provided by NooBaa. Repo will provide some examples of simple backup scenarios.

License

MoOyeg/oadp-acm-example

Repository files navigation

oadp-acm-example

Purpose of this repo is to demo an example of Red Hat Openshift API for Data Protection/OADP(Velero) with Red Hat Advanced Cluster Management(ACM) running on OpenShift.S3 Storage for this example is provided by Red Hat Openshift Data Foundation via the Multi Cloud Gatway Component(NooBaa). Repo will provide some examples of simple backup scenarios.

Prerequisites

Steps to Run

  • Create a namespace to hold our ACM policies.

    oc new-project global-policies
  • Add Subscription Admin role to the user running our ACM policies.

    oc adm policy add-cluster-role-to-user open-cluster-management:subscription-admin $(oc whoami)
  • Create list of PlacementRules we want ACM to use and can be leveraged by other policies.

    oc apply -k ./placementrules/ -n global-policies
  • Install the OADP Operator via an ACM Policy.

    kustomize build --enable-alpha-plugins ./oadp-operator/ | oc create -f -
  • Install the ODF Operator via an ACM Policy.Please see prerequisites on default storageclass above before running.

    kustomize build --enable-alpha-plugins ./noobaa-operator/ | oc create -f -
  • Create the NooBaa Object via an ACM Policy.Might take a bit before the noobaa object is fully ready.Confirm NooBaa object is ready and oadp-bucket claim is bound.

    kustomize build --enable-alpha-plugins ./noobaa-object/ | oc create -f -
  • Create the OADP Data Protection Application with Noobaa Storage via an ACM Policy.

    kustomize build --enable-alpha-plugins ./oadp-backup | oc create -f -

Backup Example 1 - Backup a Simple Application Manifest

Example shows the backup and restore of a single deployment. Backup Resource uses labels to select deployment to backed up.

  • Create a simple deployment

    oc create -f ./backup-sample1/deployment.yaml
  • Create a Backup for that deployment

    oc create -f ./backup-sample1/backup.yaml
  • Confirm the backup status is 'Completed' before proceeding

    oc get backup backup-sample1 -n openshift-adp -o jsonpath='{.status.phase}'
  • Delete the deployment

    oc delete -f ./backup-sample1/deployment.yaml
  • Confirm the deployment is completly deleted.

    oc get deployment backup-sample1 -n default
  • Create the restore

    oc create -f ./backup-sample1/restore.yaml
  • Confirm the deployment is restored.

    oc get deployment backup-sample1 -n default

Backup Example 2 - Backup an Application Manifest and PV with Restic

Example shows the backup and restore of a deployment and it's data from a pvc via the use of restic and OADP data mover feature.Example will simulate state by writing a date to a pvc and restoring the volume with the file also having the new date of when volume was restored.

  • Install the Volsync Operator which is required for restic use.

    kustomize build --enable-alpha-plugins ./volsync-operator | oc create -f -
  • Patch the OADP DataProtectionApplication to allow restic.

    kustomize build --enable-alpha-plugins ./backup-sample2 | oc create -f -
  • Confirm the volsync operator and DataProtectionApplication are available.

  • Give RBAC permissions to serviceaccount to allow writing to pod volume.

    oc create -f ./backup-sample2/rbac.yaml
  • Create PVC for deployment usage.Please see prerequisites on default storageclass above before running.

    oc create -f ./backup-sample2/pvc.yaml
  • Create deployment for backup example.

    oc create -f ./backup-sample2/deployment.yaml
  • Confirm deployment wrote date to volume file before continuing.

    oc exec deployment/backup-sample2 -n default -c container  -- cat /root/backup-sample2/backup
  • Create backup for deployment and data.

    oc create -f ./backup-sample2/backup.yaml
  • Confirm the backup status is 'Completed' before proceeding

    oc get backup backup-sample2 -n openshift-adp -o jsonpath='{.status.phase}'
  • Delete Deployment to test restore.

    oc delete -f ./backup-sample2/deployment.yaml
  • Delete PVC to test restore.

    oc delete -f ./backup-sample2/pvc.yaml
  • Confirm the deployment is completly deleted.

    oc get deployment backup-sample2 -n default
  • Confirm the PVC is completly deleted.

    oc get deployment pvc -n default
  • Restore data and Manifests.

    oc create -f ./backup-sample2/restore.yaml
  • Confirm the restore status is 'Completed' before proceeding

    oc get restore backup-sample2-restore -n openshift-adp -o jsonpath='{.status.phase}'
  • Confirm restore deployment now has the date before and after the restore.

    oc exec deployment/backup-sample2 -n default -c container  -- cat /root/backup-sample2/backup

About

Purpose of this repo is to demo an example of Red Hat Openshift API for Data Protection/OADP(Velero) with Red Hat Advanced Cluster Management(ACM) running on OpenShift.S3 Storage for this example is provided by NooBaa. Repo will provide some examples of simple backup scenarios.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages