Skip to content

Commit

Permalink
update docs/examples, use ci templates and mysql (#627)
Browse files Browse the repository at this point in the history
* update docs/examples, use ci templates and mysql

* Previously we had duplicate templates for mssql
* Templates used in docs/examples should be part of
regular ci to ensure they always work for the community
  * using softlinks from tests/e2e to docs/examples/
* update the docs s/mssql/mysql

Closes-Issue: #622

* update symlinks to be a relative path
  • Loading branch information
weshayutin committed Apr 8, 2022
1 parent a1b0d1b commit 961e54d
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 484 deletions.
140 changes: 70 additions & 70 deletions docs/examples/csi_example.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<h1 align="center">Stateful Application Backup/Restore - MSSQL</h1>
<h1 align="center">Stateful Application Backup/Restore - MySQL</h1>
<h2 align="center">CSI Volume Snapshotting with AWS EBS</h2>

### Prerequisites
* OADP operator, a credentials secret, and a DataProtectionApplication (DPA) CR
* OADP operator, a credentials secret, and a DataProtectionApplication (DPA) CR
are all created. Follow [these steps](/docs/install_olm.md) for installation instructions.

- Make sure your DPA CR is similar to below in the install step.
- Make sure your DPA CR is similar to below in the install step.
Note the `EnableCSI` feature flag and the `csi` default plugin.

* Information on `backupLocations` and `snapshotLocations` specs
can be found [here](/docs/config/bsl_and_vsl.md).
* Information on `backupLocations` and `snapshotLocations` specs
can be found [here](/docs/config/bsl_and_vsl.md).

```
apiVersion: oadp.openshift.io/v1alpha1
Expand Down Expand Up @@ -48,22 +48,22 @@
config:
region: us-west-2
profile: "default"
```


<hr style="height:1px;border:none;color:#333;">

### Create a StorageClass and VolumeShapshotClass:

- A `StorageClass` and a `VolumeSnapshotClass` are needed before the Mssql application
is created. The app will map to the `StorageClass`, which contains information about the CSI driver.
- A `StorageClass` and a `VolumeSnapshotClass` are needed before the Mssql application
is created. The app will map to the `StorageClass`, which contains information about the CSI driver.

- Include a label in `VolumeSnapshotClass` to let
- Include a label in `VolumeSnapshotClass` to let
Velero know which to use, and set `deletionPolicy` to `Retain` in order for
`VolumeSnapshotContent` to remain after the application namespace is deleted.

`oc create -f docs/examples/manifests/mssql/VolumeSnapshotClass.yaml`
`oc create -f docs/examples/manifests/mysql/VolumeSnapshotClass.yaml`

```
apiVersion: v1
Expand All @@ -81,23 +81,23 @@ items:
deletionPolicy: Retain
```

`gp2-csi` comes as a default `StorageClass` with OpenShift clusters.
`gp2-csi` comes as a default `StorageClass` with OpenShift clusters.

`oc get storageclass`
`oc get storageclass`

If this is not found, create a `StorageClass` like below:

```
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gp2-csi
annotations:
storageclass.kubernetes.io/is-default-class: 'true'
provisioner: ebs.csi.aws.com
parameters:
parameters:
type: gp2
reclaimPolicy: Delete
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
```
Expand All @@ -106,74 +106,74 @@ allowVolumeExpansion: true

### Create the Mssql deployment config:

`oc create -f docs/examples/manifests/mssql/csi-mssql-template.yaml`
`oc create -f docs/examples/manifests/mysql/mysql-persistent-csi-template.yaml`

This example will create the following resources:
* **Namespace**
* **Secret**
* **Service**
* **Route**
* **PersistentVolumeClaim**
* **Deployment**
* **Namespace**
* **Secret**
* **Service**
* **Route**
* **PersistentVolumeClaim**
* **Deployment**


### Verify application resources:

`oc get all -n mssql-persistent`
`oc get all -n mysql-persistent`

Should look similar to this:

```
NAME READY STATUS RESTARTS AGE
pod/mssql-app-deployment-6dbc8d5b64-nlmhc 1/1 Running 0 85s
pod/mssql-deployment-1-deploy 0/1 Completed 0 85s
pod/mssql-deployment-1-qfh7c 1/1 Running 0 79s
NAME READY STATUS RESTARTS AGE
pod/mysql-6bb6964964-x4s8d 1/1 Running 0 54s
pod/todolist-1-59jqk 1/1 Running 0 51s
pod/todolist-1-deploy 0/1 Completed 0 54s
NAME DESIRED CURRENT READY AGE
replicationcontroller/mssql-deployment-1 1 1 1 85s
NAME DESIRED CURRENT READY AGE
replicationcontroller/todolist-1 1 1 1 54s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/mssql-app-service ClusterIP 172.30.8.249 <none> 5000/TCP 85s
service/mssql-service ClusterIP 172.30.200.254 <none> 1433/TCP 85s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/mysql ClusterIP 172.30.73.117 <none> 3306/TCP 55s
service/todolist ClusterIP 172.30.92.118 <none> 8000/TCP 55s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/mssql-app-deployment 1/1 1 1 85s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/mysql 1/1 1 1 55s
NAME DESIRED CURRENT READY AGE
replicaset.apps/mssql-app-deployment-6dbc8d5b64 1 1 1 85s
NAME DESIRED CURRENT READY AGE
replicaset.apps/mysql-6bb6964964 1 1 1 55s
NAME REVISION DESIRED CURRENT TRIGGERED BY
deploymentconfig.apps.openshift.io/mssql-deployment 1 1 1 config
NAME REVISION DESIRED CURRENT TRIGGERED BY
deploymentconfig.apps.openshift.io/todolist 1 1 1 config
```


### Add data to application

Visit the route location provided in the `HOST/PORT` section following this command:

`oc get routes -n mssql-persistent`
`oc get routes -n mysql-persistent`

Here you will see a table of data. Enter additional data and save.
Once completed, it's time to begin a backup.


### Create application backup

`oc create -f docs/examples/manifests/mssql/mssql-backup.yaml`
`oc create -f docs/examples/manifests/mysql/mysql-backup.yaml`


### Verify the backup is completed

`oc get backup -n openshift-adp mssql-persistent -o jsonpath='{.status.phase}'`
`oc get backup -n openshift-adp mysql-persistent -o jsonpath='{.status.phase}'`
should result in `Completed`

Once completed, you should now be able to see a namespace-scoped `VolumeSnapshot`:

`oc get volumesnapshot -n mssql-persistent`
`oc get volumesnapshot -n mysql-persistent`

```
NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE
velero-mssql-pvc-kxhqc true mssql-pvc 10Gi example-snapclass snapcontent-ec0b296b-550d-4669-9eff-8fcc44f46ae2 80s 81s
velero-mysql-pvc-kxhqc true mysql-pvc 10Gi example-snapclass snapcontent-ec0b296b-550d-4669-9eff-8fcc44f46ae2 80s 81s
```


Expand All @@ -187,60 +187,60 @@ application is deleted since we set the `deletionPolicy` to `Retain` in the

```
NAME READYTOUSE RESTORESIZE DELETIONPOLICY DRIVER VOLUMESNAPSHOTCLASS VOLUMESNAPSHOT AGE
snapcontent-28527e2d-21bf-471a-ac62-044ecf8113e3 true 10737418240 Retain ebs.csi.aws.com example-snapclass velero-mssql-pvc-vnvvr 103m
velero-velero-mssql-pvc-vnvvr-4q5jl true 10737418240 Retain ebs.csi.aws.com example-snapclass velero-mssql-pvc-vnvvr 87m
snapcontent-28527e2d-21bf-471a-ac62-044ecf8113e3 true 10737418240 Retain ebs.csi.aws.com example-snapclass velero-mysql-pvc-vnvvr 103m
velero-velero-mysql-pvc-vnvvr-4q5jl true 10737418240 Retain ebs.csi.aws.com example-snapclass velero-mysql-pvc-vnvvr 87m
```

Once we have ensured the backup is completed and `VolumeSnapshotContent` is
ready, we want to test the restore process. First, delete the `mssql-persistent` project:
Once we have ensured the backup is completed and `VolumeSnapshotContent` is
ready, we want to test the restore process. First, delete the `mysql-persistent` project:

`oc delete namespace mssql-persistent`
`oc delete namespace mysql-persistent`


### Create the restore for the application

`oc create -f docs/examples/manifests/mssql/mssql-restore.yaml`
`oc create -f docs/examples/manifests/mysql/mysql-restore.yaml`


### Verify the restore is completed

`oc get restore -n openshift-adp mssql-persistent -o jsonpath='{.status.phase}'`
`oc get restore -n openshift-adp mysql-persistent -o jsonpath='{.status.phase}'`

Should result in `Completed`


### Verify all resources have been recreated in the restore process

`oc get all -n mssql-persistent`
`oc get all -n mysql-persistent`

Should look similar to this:

```
NAME READY STATUS RESTARTS AGE
pod/mssql-app-deployment-6dbc8d5b64-mx22j 1/1 Running 0 7m3s
pod/mssql-deployment-1-deploy 0/1 Completed 0 7m3s
pod/mssql-deployment-1-pzx6k 1/1 Running 0 7m
NAME READY STATUS RESTARTS AGE
pod/mysql-6bb6964964-x4s8d 1/1 Running 0 54s
pod/todolist-1-59jqk 1/1 Running 0 51s
pod/todolist-1-deploy 0/1 Completed 0 54s
NAME DESIRED CURRENT READY AGE
replicationcontroller/mssql-deployment-1 1 1 1 7m3s
NAME DESIRED CURRENT READY AGE
replicationcontroller/todolist-1 1 1 1 54s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/mssql-app-service ClusterIP 172.30.81.38 <none> 5000/TCP 7m
service/mssql-service ClusterIP 172.30.221.119 <none> 1433/TCP 7m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/mysql ClusterIP 172.30.73.117 <none> 3306/TCP 55s
service/todolist ClusterIP 172.30.92.118 <none> 8000/TCP 55s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/mssql-app-deployment 1/1 1 1 7m3s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/mysql 1/1 1 1 55s
NAME DESIRED CURRENT READY AGE
replicaset.apps/mssql-app-deployment-6dbc8d5b64 1 1 1 7m4s
NAME DESIRED CURRENT READY AGE
replicaset.apps/mysql-6bb6964964 1 1 1 55s
NAME REVISION DESIRED CURRENT TRIGGERED BY
deploymentconfig.apps.openshift.io/mssql-deployment 1 1 1 config
NAME REVISION DESIRED CURRENT TRIGGERED BY
deploymentconfig.apps.openshift.io/todolist 1 1 1 config
```

### Verify the data previously entered in the mssql table
### Verify the data previously entered in the mysql table

`oc get routes -n mssql-persistent`
`oc get routes -n mysql-persistent`

Check the data in the table previously entered is present.
Loading

0 comments on commit 961e54d

Please sign in to comment.