From 757d905dc58c2f65f6311601ef93445383e05aff Mon Sep 17 00:00:00 2001 From: Trevor Dawe Date: Tue, 6 Sep 2022 11:05:40 -0400 Subject: [PATCH 1/2] Add documentation for using CRDs if not using dellctl --- content/docs/applicationmobility/use_cases.md | 87 +++++++++++++++++-- 1 file changed, 80 insertions(+), 7 deletions(-) diff --git a/content/docs/applicationmobility/use_cases.md b/content/docs/applicationmobility/use_cases.md index 81642c3546..96376abe0c 100644 --- a/content/docs/applicationmobility/use_cases.md +++ b/content/docs/applicationmobility/use_cases.md @@ -6,54 +6,127 @@ Description: > Use Cases --- -After Application Mobility is installed, the [dellctl CLI](../../references/cli/) can be used to register clusters and manage backups and restores of applications. +After Application Mobility is installed, the [dellctl CLI](../../references/cli/) can be used to register clusters and manage backups and restores of applications. The following examples also provide references for using the Application Mobility Custom Resource Definitions (CRDs) to define Custom Resources (CRs) as an alternative to using the `dellctl` CLI. ## Backup and Restore an Application This example details the steps when an application in namespace `demo1` is being backed up and then later restored to either the same cluster or another cluster. In this sample, both Application Mobility and Velero are installed in the `application-mobility` namespace. -1. If Velero is not installed in the default `velero` namespace, set this environment variable to the namespace where it is installed: +1. If Velero is not installed in the default `velero` namespace and `dellctl` is being used, set this environment variable to the namespace where it is installed: ``` export VELERO_NAMESPACE=application-mobility ``` 1. On the source cluster, create a Backup by providing a name and the included namespace where the application is installed. The application and its data will be available in the object store bucket and can be restored at a later time. + + Using dellctl: ``` dellctl backup create backup1 --include-namespaces demo1 --namespace application-mobility ``` + Using Backup Custom Resource: + ``` + apiVersion: mobility.storage.dell.com/v1alpha1 + kind: Backup + metadata: + name: backup1 + namespace: application-mobility + spec: + includedNamespaces: [demo1] + datamover: Restic + clones: [] + ``` 1. Monitor the backup status until it is marked as Completed. + + Using dellctl: ``` dellctl backup get --namespace application-mobility ``` + + Using kubectl: + ``` + kubectl describe backups.mobility.storage.dell.com/backup1 -n application-mobility + ``` + 1. If the Storage Class name on the target cluster is different than the Storage Class name on the source cluster where the backup was created, a mapping between source and target Storage Class names must be defined. See [Changing PV/PVC Storage Classes](#changing-pvpvc-storage-classes). 1. The application and its data can be restored on either the same cluster or another cluster by referring to the backup name and providing an optional mapping of the original namespace to the target namespace. + + Using dellctl: ``` dellctl restore create restore1 --from-backup backup1 \ --namespace-mappings "demo1:restorens1" --namespace application-mobility ``` + + Using Restore Custom Resource: + ``` + apiVersion: mobility.storage.dell.com/v1alpha1 + kind: Restore + metadata: + name: restore1 + namespace: application-mobility + spec: + backupName: backup1 + namespaceMapping: + "demo1" : "restorens1" + ``` 1. Monitor the restore status until it is marked as Completed. + + Using dellctl: ``` dellctl restore get --namespace application-mobility ``` + Using kubectl: + ``` + kubectl describe restores.mobility.storage.dell.com/restore1 -n application-mobility + ``` + + ## Clone an Application This example details the steps when an application in namespace `demo1` is cloned from a source cluster to a target cluster in a single operation. In this sample, both Application Mobility and Velero are installed in the `application-mobility` namespace. -1. If Velero is not installed in the default `velero` namespace, set this environment variable to the namespace where it is installed: +1. If Velero is not installed in the default `velero` namespace and `dellctl` is being used, set this environment variable to the namespace where it is installed: ``` export VELERO_NAMESPACE=application-mobility ``` -1. Register the target cluster +1. Register the target cluster if using `dellctl` ``` - dellctl cluster add -n targetcluster -f ~/kubeconfigs/target-cluster-kubeconfig + dellctl cluster add -n targetcluster -u -f ~/kubeconfigs/target-cluster-kubeconfig ``` 1. If the Storage Class name on the target cluster is different than the Storage Class name on the source cluster where the backup was created, a mapping between source and target Storage Class names must be defined. See [Changing PV/PVC Storage Classes](#changing-pvpvc-storage-classes). 1. Create a Backup by providing a name, the included namespace where the application is installed, and the target cluster and namespace mapping where the application will be restored. + + Using dellctl: ``` dellctl backup create backup1 --include-namespaces demo1 --clones "targetcluster/demo1:restore-ns2" \ --namespace application-mobility ``` + + Using Backup Custom Resource: + ``` + apiVersion: mobility.storage.dell.com/v1alpha1 + kind: Backup + metadata: + name: backup1 + namespace: application-mobility + spec: + includedNamespaces: [demo1] + datamover: Restic + clones: + - namespaceMapping: + "demo1": "restore-ns2" + restoreOnceAvailable: true + targetCluster: targetcluster + ``` + 1. Monitor the restore status on the target cluster until it is marked as Completed. + + Using dellctl: + ``` + dellctl restore get --namespace application-mobility ``` - dellctl restore get --cluster-id targetcluster --namespace application-mobility + + Using kubectl: + ``` + kubectl get restores.mobility.storage.dell.com -n application-mobility + kubectl describe restores.mobility.storage.dell.com/ -n application-mobility ``` ## Changing PV/PVC Storage Classes @@ -69,4 +142,4 @@ metadata: velero.io/change-storage-class: RestoreItemAction data: : -``` \ No newline at end of file +``` From 56e16105e2e9d666045fc906002f7f00ebfb0581 Mon Sep 17 00:00:00 2001 From: Trevor Dawe Date: Tue, 6 Sep 2022 11:14:07 -0400 Subject: [PATCH 2/2] Updated wording --- content/docs/applicationmobility/use_cases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/applicationmobility/use_cases.md b/content/docs/applicationmobility/use_cases.md index 96376abe0c..544a3dcd26 100644 --- a/content/docs/applicationmobility/use_cases.md +++ b/content/docs/applicationmobility/use_cases.md @@ -6,7 +6,7 @@ Description: > Use Cases --- -After Application Mobility is installed, the [dellctl CLI](../../references/cli/) can be used to register clusters and manage backups and restores of applications. The following examples also provide references for using the Application Mobility Custom Resource Definitions (CRDs) to define Custom Resources (CRs) as an alternative to using the `dellctl` CLI. +After Application Mobility is installed, the [dellctl CLI](../../references/cli/) can be used to register clusters and manage backups and restores of applications. These examples also provide references for using the Application Mobility Custom Resource Definitions (CRDs) to define Custom Resources (CRs) as an alternative to using the `dellctl` CLI. ## Backup and Restore an Application This example details the steps when an application in namespace `demo1` is being backed up and then later restored to either the same cluster or another cluster. In this sample, both Application Mobility and Velero are installed in the `application-mobility` namespace.