Skip to content

Commit

Permalink
adding storageID and replicationID to classes
Browse files Browse the repository at this point in the history
add storageID, replicationID to StorageClass, replicationClasses
and snapshotClasses. this is to faciltate filtering of
multiple storageClasses

Signed-off-by: rakeshgm <[email protected]>
  • Loading branch information
rakeshgm authored and nirs committed Nov 10, 2024
1 parent 78d25e6 commit 10089bc
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 30 deletions.
5 changes: 5 additions & 0 deletions test/addons/rbd-mirror/start
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ def configure_rbd_mirroring(cluster, peer_info):
context=cluster,
)

print("Creating VolumeReplicationClass")
template = drenv.template("start-data/vrc-sample.yaml")
yaml = template.substitute(cluster=cluster)
kubectl.apply("--filename=-", input=yaml, context=cluster)

print(f"Apply rbd mirror to cluster '{cluster}'")
kubectl.apply("--kustomize=start-data", context=cluster)

Expand Down
1 change: 0 additions & 1 deletion test/addons/rbd-mirror/start-data/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

---
resources:
- vrc-sample.yaml
- vgrc-sample.yaml
- rbd-mirror.yaml

Expand Down
3 changes: 3 additions & 0 deletions test/addons/rbd-mirror/start-data/vrc-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ apiVersion: replication.storage.openshift.io/v1alpha1
kind: VolumeReplicationClass
metadata:
name: vrc-sample
labels:
ramendr.openshift.io/storageid: rook-ceph-$cluster-1
ramendr.openshift.io/replicationid: rook-ceph-replication-1
spec:
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
Expand Down
10 changes: 0 additions & 10 deletions test/addons/rook-cephfs/cache

This file was deleted.

9 changes: 0 additions & 9 deletions test/addons/rook-cephfs/kustomization.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions test/addons/rook-cephfs/snapshot-class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

# yamllint disable-line rule:line-length
# Source: https://raw.githubusercontent.com/rook/rook/release-1.15/deploy/examples/csi/cephfs/snapshotclass.yaml
# Modifications:
# - Added storageID
---
apiVersion: snapshot.storage.k8s.io/v1
deletionPolicy: Delete
driver: rook-ceph.cephfs.csi.ceph.com
kind: VolumeSnapshotClass
metadata:
name: csi-cephfsplugin-snapclass
labels:
ramendr.openshift.io/storageid: rook-cephfs-$cluster-1
parameters:
clusterID: rook-ceph
csi.storage.k8s.io/snapshotter-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/snapshotter-secret-namespace: rook-ceph
17 changes: 13 additions & 4 deletions test/addons/rook-cephfs/start
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@ import os
import sys

import drenv
from drenv import cache
from drenv import kubectl


def deploy(cluster):
print("Creating CephFS instance and storage/snapshot classes")
path = cache.get(".", "addons/rook-cephfs-1.15.yaml")
kubectl.apply("--filename", path, context=cluster)

print("Creating CephFS instance")
kubectl.apply("--filename=filesystem.yaml", context=cluster)

print("Creating StorageClass")
template = drenv.template("storage-class.yaml")
yaml = template.substitute(cluster=cluster)
kubectl.apply("--filename=-", input=yaml, context=cluster)

print("Creating SnapshotClass")
template = drenv.template("snapshot-class.yaml")
yaml = template.substitute(cluster=cluster)
kubectl.apply("--filename=-", input=yaml, context=cluster)


def wait(cluster):
Expand Down
27 changes: 27 additions & 0 deletions test/addons/rook-cephfs/storage-class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

# yamllint disable-line rule:line-length
# Source: https://raw.githubusercontent.com/rook/rook/release-1.15/deploy/examples/csi/cephfs/storageclass.yaml
# Modifications:
# - Added storageID
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rook-cephfs
labels:
ramendr.openshift.io/storageid: rook-cephfs-$cluster-1
provisioner: rook-ceph.cephfs.csi.ceph.com
parameters:
clusterID: rook-ceph
fsName: myfs
pool: myfs-replicated
csi.storage.k8s.io/provisioner-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
csi.storage.k8s.io/node-stage-secret-name: rook-csi-cephfs-node
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
reclaimPolicy: Delete
allowVolumeExpansion: true
2 changes: 2 additions & 0 deletions test/addons/rook-pool/snapshot-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: csi-rbdplugin-snapclass
labels:
ramendr.openshift.io/storageid: rook-ceph-$cluster-1
driver: rook-ceph.rbd.csi.ceph.com
parameters:
clusterID: rook-ceph
Expand Down
14 changes: 8 additions & 6 deletions test/addons/rook-pool/start
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ from drenv import kubectl


def deploy(cluster):
print("Creating RBD pool and storage/snapshot classes")

print("Creating StorageClass")
template = drenv.template("storage-class.yaml")
yaml = template.substitute(cluster=cluster)
kubectl.apply("--filename=-", input=yaml, context=cluster)

print("Creating RBD pool")
kubectl.apply("--filename=replica-pool.yaml", context=cluster)

print("Creating SnapshotClass")
template = drenv.template("snapshot-class.yaml")
yaml = template.substitute(cluster=cluster)
kubectl.apply("--filename=-", input=yaml, context=cluster)
kubectl.apply(
"--filename=replica-pool.yaml",
"--filename=snapshot-class.yaml",
context=cluster,
)


def wait(cluster):
Expand Down

0 comments on commit 10089bc

Please sign in to comment.