Skip to content

kurwang/oadp-operator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OADP Operator

Overview

OADP is OpenShift Application Data Protection operator. This operator sets up and installs Velero on the OpenShift platform.

Prerequisites

  • Docker/Podman
  • OpenShift CLI
  • Access to OpenShift cluster

Getting Started

Cloning the Repository

Checkout this OADP Operator repository:

git clone git@github.com:konveyor/oadp-operator.git
cd oadp-operator

Building the Operator

Build the OADP operator image and push it to a public registry (quay.io or dockerhub)

There are two ways to build the operator image:

  • Using operator-sdk
    operator-sdk build oadp-operator
    
  • Using Podman/Docker
    podman build -f build/Dockerfile . -t oadp-operator:latest
    

After successfully building the operator image, push it to a public registry.

Using the Image

In order to use the built image, please update the operator.yaml file. Replace the REPLACE_IMAGE place holder with with the image registry URL. You can edit the file manually or use the following command (Be sure to replace the REGISTRY_URL with your own registry URL):

sed -i 's|REPLACE_IMAGE|<REGISTRY_URL>|g' deploy/operator.yaml

For OSX, use the following command:

sed -i "" 's|REPLACE_IMAGE|<REGISTRY_URL>|g' deploy/operator.yaml

Before proceeding further make sure the REPLACE_IMAGE place holder is updated in the operator.yaml file as discussed above.

Operator installation

To install OADP operator and the essential Velero components follow the steps given below:

  • Create a new namespace named oadp-operator
    oc create namespace oadp-operator
    
  • Switch to the oadp-operator namespace
    oc project oadp-operator
    
  • Create secret for the cloud provider credentials to be used. Also, the credentials file present at CREDENTIALS_FILE_PATH shoud be in proper format, for instance if the provider is AWS it should follow this AWS credentials template
    oc create secret generic <SECRET_NAME> --namespace oadp-operator --from-file cloud=<CREDENTIALS_FILE_PATH>
    
  • Now to create the deployment, role, role binding, service account and the cluster role binding, use the following command:
    oc create -f deploy/
    
  • Deploy the Velero custom resource definition:
    oc create -f deploy/crds/konveyor.openshift.io_veleros_crd.yaml   
    
  • Finally, deploy the Velero CR:
    oc create -f deploy/crds/konveyor.openshift.io_v1alpha1_velero_cr.yaml
    

Post completion of all the above steps, you can check if the operator was successfully installed or not, the expected result for the command oc get all -n oadp-operator is as follows:

NAME                                 READY     STATUS    RESTARTS   AGE
pod/oadp-operator-7749f885f6-9nm9w   1/1       Running   0          6m6s
pod/restic-48s5r                     1/1       Running   0          2m16s
pod/restic-5sr4c                     1/1       Running   0          2m16s
pod/restic-bs5p2                     1/1       Running   0          2m16s
pod/velero-76546b65c8-tm9vv          1/1       Running   0          2m16s

NAME                            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
service/oadp-operator-metrics   ClusterIP   172.30.21.118   <none>        8383/TCP,8686/TCP   5m51s

NAME                    DESIRED   CURRENT   READY     UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
daemonset.apps/restic   3         3         3         3            3           <none>          2m17s

NAME                            READY     UP-TO-DATE   AVAILABLE   AGE
deployment.apps/oadp-operator   1/1       1            1           6m7s
deployment.apps/velero          1/1       1            1           2m17s

NAME                                       DESIRED   CURRENT   READY     AGE
replicaset.apps/oadp-operator-7749f885f6   1         1         1         6m7s
replicaset.apps/velero-76546b65c8          1         1         1         2m17s

Note: For using the velero CLI directly configured for the oadp-operator namespace, you may want to use the following command:

velero client config set namespace=oadp-operator

Configure Velero Plugins

There are mainly two categories of velero plugins that can be specified while installing Velero:

  1. default-velero-plugins:
    4 types of default velero plugins can be installed - AWS, GCP, Azure and OpenShift. For installation, you need to specify them in the konveyor.openshift.io_v1alpha1_velero_cr.yaml file during deployment.

     apiVersion: konveyor.openshift.io/v1alpha1
     kind: Velero
     metadata:
       name: example-velero
     spec:
       default_velero_plugins:
       - azure
       - gcp
       - aws
       - openshift    
    

    The above specification will install Velero with all the 4 default plugins.

  2. custom-velero-plugin:
    For installation of custom velero plugins, you need to specify the plugin image and plugin name in the konveyor.openshift.io_v1alpha1_velero_cr.yaml file during deployment.

    For instance,

     apiVersion: konveyor.openshift.io/v1alpha1
     kind: Velero
     metadata:
       name: example-velero
     spec:
       default_velero_plugins:
       - azure
       - gcp
       custom_velero_plugins:
       - name: custom-plugin-example
         image: quay.io/example-repo/custom-velero-plugin   
    

    The above specification will install Velero with 3 plugins (azure, gcp and custom-plugin-example).

Configure Backup Storage Locations and Volume Snapshot Locations

For configuring the backupStorageLocations and the volumeSnapshotLocations we will be using the backup_storage_locations and the volume_snapshot_locations specs respectively in the konveyor.openshift.io_v1alpha1_velero_cr.yaml file during the deployement.

For instance, If we want to configure aws for backupStorageLocations as well as volumeSnapshotLocations pertaining to velero, our konveyor.openshift.io_v1alpha1_velero_cr.yaml file should look something like this:

apiVersion: konveyor.openshift.io/v1alpha1
kind: Velero
metadata:
  name: example-velero
spec:
  default_velero_plugins:
  - aws
  backup_storage_locations:
  - name: default
    provider: aws
    object_storage:
      bucket: myBucket
      prefix: "velero"
    config:
      region: us-east-1
      profile: "default"
    credentials_secret_ref:
      name: cloud-credentials
      namespace: oadp-operator
  volume_snapshot_locations:
  - name: default
    provider: aws
    config:
      region: us-west-2
      profile: "default"

Note:

  • Be sure to use the same secret name you used while creating the cloud credentials secret in step 3 of Operator installation section.
  • Do not configure more than one backupStorageLocations per cloud provider, the velero installation will fail.
  • Parameter reference for backupStorageLocations and volumeSnapshotLocations

Cleanup

For cleaning up the deployed resources, use the following commands:

oc delete -f deploy/crds/konveyor.openshift.io_v1alpha1_velero_cr.yaml
oc delete -f deploy/crds/konveyor.openshift.io_veleros_crd.yaml   
oc delete -f deploy/
oc delete namespace oadp-operator
oc delete crd $(oc get crds | grep velero.io | awk -F ' ' '{print $1}')

About

OADP Operator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 100.0%