(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ AZURE_CLIENT_ID=`az ad sp list --display-name "mayapvelero" --query '[0].appId' -o tsv`
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ cat << EOF  > ./credentials-velero
> AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID}
> AZURE_TENANT_ID=${AZURE_TENANT_ID}
> AZURE_CLIENT_ID=${AZURE_CLIENT_ID}
> AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET}
> AZURE_STORAGE_ACCOUNT_ACCESS_KEY=${STORAGE_ACCOUNT_KEY}
> AZURE_RESOURCE_GROUP=${AZURE_RESOURCE_GROUP}
> AZURE_CLOUD_NAME=AzurePublicCloud
> EOF
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc create secret generic cloud-credentials-azure --namespace velero --from-file cloud=credentials-velero
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc get dpa -n velero -o yaml
error: the server doesn't have a resource type "dpa"
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc get pods -n velero
NAME                                                READY   STATUS    RESTARTS   AGE
openshift-adp-controller-manager-645c4bb755-rrqdx   1/1     Running   0          108s
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ cat << EOF  > ./credentials-velero-sa
> AZURE_STORAGE_ACCOUNT_ACCESS_KEY=${STORAGE_ACCOUNT_KEY}
> AZURE_CLOUD_NAME=AzurePublicCloud
> AZURE_RESOURCE_GROUP=${AZURE_RESOURCE_GROUP}
> AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID}
> EOF
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc create secret generic custom --namespace velero --from-file cloud=credentials-velero-sa
secret/custom created
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ MSQL_NS=mysql-persistent
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ wget -qO- https://downloads.mysql.com/docs/world-db.tar.gz | tar xvz  -C /tmp/mysql/
world-db/
world-db/world.sql
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc -n $MSQL_NS rsync /tmp/mysql/world-db/ $(oc -n $MSQL_NS get pods -o name):/tmp/
WARNING: cannot use rsync: rsync not available in container
world.sql
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc -n $MSQL_NS rsh $(oc get pods -n $MSQL_NS -o name) ${MYSQL_BINARY_PATH}mysql -u root -e "source /tmp/world.sql; show schemas;"

+---------------------+
| Database            |
+---------------------+
| information_schema  |
| #mysql50#lost+found |
| mysql               |
| performance_schema  |
| test                |
| world               |
+---------------------+
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ cat <<EOF | oc create -f -
> apiVersion: oadp.openshift.io/v1alpha1
> kind: DataProtectionApplication
> metadata:
>   namespace: velero
>   name: example-velero
> spec:
>   configuration:
>     velero:
>       defaultPlugins:
>       - openshift
>       - csi
>       - azure
>     restic:
>       enable: true
>   backupLocations:
>     - name: default
>       velero:
>         provider: azure
>         default: true
>         objectStorage:
>           bucket: $BLOB_CONTAINER
>           prefix: velero
>         credential:
>           name: custom
>           key: cloud
>         config:
>           resourceGroup: $AZURE_RESOURCE_GROUP
>           storageAccount: $AZURE_STORAGE_ACCOUNT_ID
>           storageAccountKeyEnvVar: AZURE_STORAGE_ACCOUNT_ACCESS_KEY
>           subscriptionId: $AZURE_SUBSCRIPTION_ID
>   snapshotLocations:
>     - name: default
>       velero:
>         default: true
>         provider: azure
>         config:
>           resourceGroup: $AZURE_RESOURCE_GROUP
>           subscriptionId: $AZURE_SUBSCRIPTION_ID
>   olmManaged: true
> EOF
dataprotectionapplication.oadp.openshift.io/example-velero created
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc get dpa -n velero
NAME             AGE
example-velero   5s
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc get dpa -n velero -o yaml
apiVersion: v1
items:
- apiVersion: oadp.openshift.io/v1alpha1
  kind: DataProtectionApplication
  metadata:
    creationTimestamp: "2022-01-19T13:13:54Z"
    generation: 1
    name: example-velero
    namespace: velero
    resourceVersion: "37926"
    uid: 35a2d2f3-3f4b-413c-aa8e-746c82fac9f3
  spec:
    backupLocations:
    - velero:
        config:
          resourceGroup: mayap-oadp1234-f28br-rg
          storageAccount: velerobackups12345
          storageAccountKeyEnvVar: AZURE_STORAGE_ACCOUNT_ACCESS_KEY
          subscriptionId: 53b8f551-f0fc-4bea-8cba-6d1fefd54c8a
        credential:
          key: cloud
          name: custom
        default: true
        objectStorage:
          bucket: veleromayap
          prefix: velero
        provider: azure
    configuration:
      restic:
        enable: true
      velero:
        defaultPlugins:
        - openshift
        - csi
        - azure
    snapshotLocations:
    - velero:
        config:
          resourceGroup: mayap-oadp1234-f28br-rg
          subscriptionId: 53b8f551-f0fc-4bea-8cba-6d1fefd54c8a
        provider: azure
  status:
    conditions:
    - lastTransitionTime: "2022-01-19T13:13:55Z"
      message: Reconcile complete
      reason: Complete
      status: "True"
      type: Reconciled
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup create backup$((i++)) --include-namespaces=$MSQL_NS
Backup request "backup12" submitted successfully.
Run `velero backup describe backup12` or `velero backup logs backup12` for more details.
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS   ERRORS   WARNINGS   CREATED   EXPIRES   STORAGE LOCATION   SELECTOR
backup12   New      0        0          <nil>     29d                          <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS   ERRORS   WARNINGS   CREATED   EXPIRES   STORAGE LOCATION   SELECTOR
backup12   New      0        0          <nil>     29d                          <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS   ERRORS   WARNINGS   CREATED   EXPIRES   STORAGE LOCATION   SELECTOR
backup12   New      0        0          <nil>     29d                          <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS   ERRORS   WARNINGS   CREATED   EXPIRES   STORAGE LOCATION   SELECTOR
backup12   New      0        0          <nil>     29d                          <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS   ERRORS   WARNINGS   CREATED   EXPIRES   STORAGE LOCATION   SELECTOR
backup12   New      0        0          <nil>     29d                          <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS   ERRORS   WARNINGS   CREATED   EXPIRES   STORAGE LOCATION   SELECTOR
backup12   New      0        0          <nil>     29d                          <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS       ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   InProgress   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS       ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   InProgress   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS       ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   InProgress   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS       ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   InProgress   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS       ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   InProgress   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS       ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   InProgress   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get



NAME       STATUS       ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   InProgress   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS      ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   Completed   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc delete -f mysql-persistent-template.yaml 
namespace "mysql-persistent" deleted
secret "mysql" deleted
service "mysql" deleted
persistentvolumeclaim "mysql" deleted
deployment.apps "mysql" deleted
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero restore create --from-backup backup$((i-1)) --restore-volumes=true
Restore request "backup12-20220119151915" submitted successfully.
Run `velero restore describe backup12-20220119151915` or `velero restore logs backup12-20220119151915` for more details.
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ velero backup get
NAME       STATUS      ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
backup12   Completed   0        0          2022-01-19 15:14:42 +0200 IST   29d       example-velero-1   <none>
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ oc -n $MSQL_NS rsh $(oc get pods -n $MSQL_NS -o name) ${MYSQL_BINARY_PATH}mysql -u root -e "show schemas;"
+---------------------+
| Database            |
+---------------------+
| information_schema  |
| #mysql50#lost+found |
| mysql               |
| performance_schema  |
| test                |
| world               |
+---------------------+
(mtc-e2e-venv) [mperetz@mperetz velero-examples]$ 
