Skip to content

Commit

Permalink
doc: update doc for disaster recovery
Browse files Browse the repository at this point in the history
Volume Replication has been added to csi-addons
as a feature in it sometime back. But the doc still
uses the volume replication operator to enable
mirroring and create related resources for
disaster recovery.
this commit updates the document to use csi-addons
instead of creating volumereplication sidecar.

Signed-off-by: yati1998 <[email protected]>
  • Loading branch information
yati1998 committed Oct 14, 2024
1 parent 3802dd2 commit 8617034
Showing 1 changed file with 32 additions and 63 deletions.
95 changes: 32 additions & 63 deletions docs/disaster-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,91 +17,60 @@ This documentation assumes that `rbd mirroring` is set up between
For more information on how to set up rbd mirroring, refer to
[ceph documentation](https://docs.ceph.com/en/latest/rbd/rbd-mirroring/).

## Deploy the Volume Replication CRD
## Enable CSI-ADDONS Sidecar

Volume Replication Operator is a kubernetes operator that provides common
and reusable APIs for storage disaster recovery.
It is based on [csi-addons/spec](https://github.com/csi-addons/spec)
specification and can be used by any storage provider.
Enable the CSI-Addons sidecar by adding the following configuration to
the rook-ceph-operator-config:

Volume Replication Operator follows controller pattern and provides
extended APIs for storage disaster recovery.
The extended APIs are provided via Custom Resource Definition (CRD).
```
CSI_ENABLE_CSIADDONS: "false"
ROOK_CSIADDONS_IMAGE: "quay.io/csiaddons/k8s-sidecar:v0.10.0"
```

``` bash
kubectl edit cm rook-ceph-operator-config -nrook-ceph
```

CSI-Addons supports the Volume Replication feature that provides common
and reusable APIs for storage disaster recovery.
It is based on [csi-addons/spec](https://github.com/csi-addons/spec) specification
and can be used by any storage provider.

>:bulb: For more information, please refer to the
> [volume-replication-operator](https://github.com/csi-addons/volume-replication-operator).
* Deploy the `VolumeReplicationClass` CRD
Deploy the CSI-Addons controller

```bash
kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/release-v0.1/config/crd/bases/replication.storage.openshift.io_volumereplicationclasses.yaml
kubectl create -f https://raw.githubusercontent.com/csi-addons/kubernetes-csi-addons/main/deploy/controller/setup-controller.yaml
```

customresourcedefinition.apiextensions.k8s.io/volumereplicationclasses.replication.storage.openshift.io created
Deploy the CSI-Addons CRD to create all related crds for volumereplication

```bash
kubectl create -f https://raw.githubusercontent.com/csi-addons/kubernetes-csi-addons/main/deploy/controller/crds.yaml
```

* Deploy the `VolumeReplication` CRD
The following crds gets created

```bash
kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/release-v0.1/config/crd/bases/replication.storage.openshift.io_volumereplications.yaml

customresourcedefinition.apiextensions.k8s.io/volumereplications.replication.storage.openshift.io created created
```
volumereplicationclasses.replication.storage.openshift.io
volumereplications.replication.storage.openshift.io
```

The VolumeReplicationClass and VolumeReplication CRDs are now created.

>:bulb: **Note:** Use the latest available release for Volume Replication Operator.
> See [releases](https://github.com/csi-addons/volume-replication-operator/branches)
>:bulb: **Note:** Use the latest available release for CSI Addons Operator.
> See [releases](https://github.com/csi-addons/kubernetes-csi-addons/branches)
> for more information.
### Add RBAC rules for Volume Replication Operator
### Add RBAC rules for CSI-Addons Operator

Add the below mentioned rules to `rbd-external-provisioner-runner`
ClusterRole in [csi-provisioner-rbac.yaml](https://github.com/ceph/ceph-csi/blob/release-v3.3/deploy/rbd/kubernetes/csi-provisioner-rbac.yaml)
Add RBAC rules to enable the csi-addons operator which contains
all related rbac rules to anable the volume replication feature

```yaml
- apiGroups: ["replication.storage.openshift.io"]
resources: ["volumereplications", "volumereplicationclasses"]
verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
- apiGroups: ["replication.storage.openshift.io"]
resources: ["volumereplications/finalizers"]
verbs: ["update"]
- apiGroups: ["replication.storage.openshift.io"]
resources: ["volumereplications/status"]
verbs: ["get", "patch", "update"]
- apiGroups: ["replication.storage.openshift.io"]
resources: ["volumereplicationclasses/status"]
verbs: ["get"]
```

### Deploy the Volume Replication Sidecar

To deploy `volume-replication` sidecar container in `csi-rbdplugin-provisioner`
pod, add the following yaml to
[csi-rbdplugin-provisioner deployment](https://github.com/ceph/ceph-csi/blob/release-v3.3/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml).

```yaml
- name: volume-replication
image: quay.io/csiaddons/volumereplication-operator:v0.1.0
args :
- "--metrics-bind-address=0"
- "--leader-election-namespace=$(NAMESPACE)"
- "--driver-name=rbd.csi.ceph.com"
- "--csi-address=$(ADDRESS)"
- "--rpc-timeout=150s"
- "--health-probe-bind-address=:9998"
- "--leader-elect=true"
env:
- name: ADDRESS
value: unix:///csi/csi-provisioner.sock
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /csi
kubectl create -f https://raw.githubusercontent.com/csi-addons/kubernetes-csi-addons/main/deploy/controller/rbac.yaml
```

## VolumeReplicationClass and VolumeReplication
Expand Down

0 comments on commit 8617034

Please sign in to comment.