|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * backup_and_restore/application_backup_and_restore/oadp-data-protection-test.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="oadp-dpt-use-case-azure_{context}"] |
| 7 | += Running a data protection test on an Azure object storage |
| 8 | + |
| 9 | +[role="_abstract"] |
| 10 | +If you are using {oadp-short} on an Azure object storage, you need to specify the Azure `STORAGE_ACCOUNT_ID` as part of the secret object. Use the following procedure to run a `DataProtectionTest` (DPT) custom resource (CR) on an Azure cluster. |
| 11 | + |
| 12 | + |
| 13 | +.Prerequisites |
| 14 | + |
| 15 | +* You have logged in to the Azure cluster as a user with the `cluster-admin` role. |
| 16 | +* You have installed the OpenShift CLI (`oc`). |
| 17 | +* You have installed the {oadp-short} Operator. |
| 18 | +* You have configured a bucket to store the backups. |
| 19 | +* You have an application with persistent volume claims (PVCs) running in a separate namespace. |
| 20 | +
|
| 21 | +
|
| 22 | +.Procedure |
| 23 | + |
| 24 | +. Add the `Storage Blob Data Contributor` role to Azure `storageAccount` object to avoid DPT run failure. Run the following command: |
| 25 | ++ |
| 26 | +[source,terminal] |
| 27 | +---- |
| 28 | +$ az role assignment create \ |
| 29 | +--assignee "$AZURE_CLIENT_ID" \ |
| 30 | +--role "Storage Blob Data Contributor" \ |
| 31 | +--scope "/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$AZURE_RESOURCE_GROUP/providers/Microsoft.Storage/storageAccounts/$AZURE_STORAGE_ACCOUNT_ID" |
| 32 | +---- |
| 33 | + |
| 34 | +. In your terminal, export the Azure parameters and create a secret credentials file with the parameters as shown in the following example. |
| 35 | ++ |
| 36 | +To run the DPT CR on Azure, you need to specify the `STORAGE_ACCOUNT_ID` parameter in the secret credentials file. |
| 37 | ++ |
| 38 | +[source,terminal] |
| 39 | +---- |
| 40 | +AZURE_SUBSCRIPTION_ID=<subscription-id> |
| 41 | +AZURE_TENANT_ID=<tenant-id> |
| 42 | +AZURE_CLIENT_ID=<client-id> |
| 43 | +AZURE_CLIENT_SECRET=<client-secret> |
| 44 | +AZURE_RESOURCE_GROUP=<resource-group> |
| 45 | +AZURE_STORAGE_ACCOUNT_ID=<storage-account> |
| 46 | +---- |
| 47 | + |
| 48 | +. Create the `Secret` CR as shown in the following example: |
| 49 | ++ |
| 50 | +[source,terminal] |
| 51 | +---- |
| 52 | +$ oc create secret generic cloud-credentials-azure -n openshift-adp --from-file cloud=<credentials_file_path> |
| 53 | +---- |
| 54 | + |
| 55 | +. Create the `DataProtectionApplication` (DPA) CR by using the configuration shown in the following example: |
| 56 | ++ |
| 57 | +[source,yaml] |
| 58 | +---- |
| 59 | +apiVersion: oadp.openshift.io/v1alpha1 |
| 60 | +kind: DataProtectionApplication |
| 61 | +metadata: |
| 62 | + name: ts-dpa |
| 63 | + namespace: openshift-adp |
| 64 | +spec: |
| 65 | + configuration: |
| 66 | + velero: |
| 67 | + defaultPlugins: |
| 68 | + - azure |
| 69 | + - openshift |
| 70 | + backupLocations: |
| 71 | + - velero: |
| 72 | + config: |
| 73 | + resourceGroup: oadp-....-b7q4-rg |
| 74 | + storageAccount: oadp...kb7q4 |
| 75 | + subscriptionId: 53b8f5...fd54c8a |
| 76 | + credential: |
| 77 | + key: cloud |
| 78 | + name: cloud-credentials-azure # <1> |
| 79 | + provider: azure |
| 80 | + default: true |
| 81 | + objectStorage: |
| 82 | + bucket: <bucket_name> |
| 83 | + prefix: velero |
| 84 | +---- |
| 85 | +<1> Specify the name of the `Secret` object. In this example, the name is `cloud-credentials-azure`. |
| 86 | + |
| 87 | +. Create the DPT CR by specifying the name of backup storage location (BSL), `VolumeSnapshotClass` object, and the persistent volume claim details as shown in the following example: |
| 88 | ++ |
| 89 | +[source,yaml] |
| 90 | +---- |
| 91 | +apiVersion: oadp.openshift.io/v1alpha1 |
| 92 | +kind: DataProtectionTest |
| 93 | +metadata: |
| 94 | + name: dpt-sample |
| 95 | + namespace: openshift-adp |
| 96 | +spec: |
| 97 | + backupLocationName: <bsl_name> # <1> |
| 98 | + uploadSpeedTestConfig: |
| 99 | + fileSize: 40MB |
| 100 | + timeout: 120s |
| 101 | + csiVolumeSnapshotTestConfigs: |
| 102 | + - snapshotClassName: csi-azuredisk-vsc # <2> |
| 103 | + timeout: 90s |
| 104 | + volumeSnapshotSource: |
| 105 | + persistentVolumeClaimName: mysql-data # <3> |
| 106 | + persistentVolumeClaimNamespace: ocp-mysql # <4> |
| 107 | + - snapshotClassName: csi-azuredisk-vsc |
| 108 | + timeout: 120s |
| 109 | + volumeSnapshotSource: |
| 110 | + persistentVolumeClaimName: mysql-data1 |
| 111 | + persistentVolumeClaimNamespace: ocp-mysql |
| 112 | +---- |
| 113 | +<1> Specify the name of the BSL. |
| 114 | +<2> The Azure snapshot class name. |
| 115 | +<3> The name of the persistent volume claim. |
| 116 | +<4> The name of the persistent volume claim namespace. |
| 117 | + |
| 118 | +. Run the DPT CR to verify the snapshot readiness. |
0 commit comments