Skip to content

Commit

Permalink
Fix Duplicate SID issue for RBD and CephFS SCs
Browse files Browse the repository at this point in the history
In the referenced PRs [1] and [2], two StorageClasses were
created for RBD and two for CephFS. Both RBD and CephFS
StorageClasses had duplicate storageIDs. This commit resolves
the duplicate storageID issue.

References:
[1] #1756
[2] #1770

Signed-off-by: rakeshgm <[email protected]>
  • Loading branch information
rakeshgm authored and nirs committed Feb 19, 2025
1 parent 5c29c2a commit 82a4836
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 12 deletions.
6 changes: 4 additions & 2 deletions test/addons/rbd-mirror/start
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ def configure_rbd_mirroring(cluster, peer_info):

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

template = drenv.template("start-data/vgrc-sample.yaml")
yaml = template.substitute(cluster=cluster, pool=POOL_NAME)
yaml = template.substitute(
cluster=cluster, pool=POOL_NAME, scname="rook-ceph-block"
)
kubectl.apply("--filename=-", input=yaml, context=cluster)

print(f"Apply rbd mirror to cluster '{cluster}'")
Expand Down
2 changes: 1 addition & 1 deletion test/addons/rbd-mirror/start-data/vgrc-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kind: VolumeGroupReplicationClass
metadata:
name: vgrc-sample
labels:
ramendr.openshift.io/storageid: rook-ceph-$cluster-1
ramendr.openshift.io/storageid: $scname-$cluster-1
ramendr.openshift.io/replicationid: rook-ceph-replication-1
spec:
provisioner: rook-ceph.rbd.csi.ceph.com
Expand Down
2 changes: 1 addition & 1 deletion test/addons/rbd-mirror/start-data/vrc-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kind: VolumeReplicationClass
metadata:
name: vrc-sample
labels:
ramendr.openshift.io/storageid: rook-ceph-$cluster-1
ramendr.openshift.io/storageid: $scname-$cluster-1
ramendr.openshift.io/replicationid: rook-ceph-replication-1
spec:
provisioner: rook-ceph.rbd.csi.ceph.com
Expand Down
2 changes: 1 addition & 1 deletion test/addons/rook-cephfs/snapshot-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ kind: VolumeSnapshotClass
metadata:
name: csi-cephfsplugin-snapclass
labels:
ramendr.openshift.io/storageid: rook-cephfs-$cluster-1
ramendr.openshift.io/storageid: $scname-$cluster-1
parameters:
clusterID: rook-ceph
csi.storage.k8s.io/snapshotter-secret-name: rook-csi-cephfs-provisioner
Expand Down
9 changes: 7 additions & 2 deletions test/addons/rook-cephfs/start
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import sys
import drenv
from drenv import kubectl

STORAGE_CLASS_NAME_PREFIX = "rook-cephfs-"
FILE_SYSTEMS = ["test-fs1", "test-fs2"]


Expand All @@ -21,12 +22,16 @@ def deploy(cluster):

print("Creating StorageClass")
template = drenv.template("storage-class.yaml")
yaml = template.substitute(cluster=cluster, fsname=file_system)
storage_class_name = STORAGE_CLASS_NAME_PREFIX + file_system
yaml = template.substitute(
cluster=cluster, fsname=file_system, name=storage_class_name
)
kubectl.apply("--filename=-", input=yaml, context=cluster)

print("Creating SnapshotClass")
template = drenv.template("snapshot-class.yaml")
yaml = template.substitute(cluster=cluster)
storage_class_name = STORAGE_CLASS_NAME_PREFIX + FILE_SYSTEMS[0]
yaml = template.substitute(cluster=cluster, scname=storage_class_name)
kubectl.apply("--filename=-", input=yaml, context=cluster)


Expand Down
4 changes: 2 additions & 2 deletions test/addons/rook-cephfs/storage-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rook-cephfs-$fsname
name: $name
labels:
ramendr.openshift.io/storageid: rook-cephfs-$cluster-1
ramendr.openshift.io/storageid: $name-$cluster-1
provisioner: rook-ceph.cephfs.csi.ceph.com
parameters:
clusterID: rook-ceph
Expand Down
2 changes: 1 addition & 1 deletion test/addons/rook-pool/snapshot-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ kind: VolumeSnapshotClass
metadata:
name: csi-rbdplugin-snapclass
labels:
ramendr.openshift.io/storageid: rook-ceph-$cluster-1
ramendr.openshift.io/storageid: $scname-$cluster-1
driver: rook-ceph.rbd.csi.ceph.com
parameters:
clusterID: rook-ceph
Expand Down
2 changes: 1 addition & 1 deletion test/addons/rook-pool/start
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def deploy(cluster):

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


Expand Down
2 changes: 1 addition & 1 deletion test/addons/rook-pool/storage-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kind: StorageClass
metadata:
name: $name
labels:
ramendr.openshift.io/storageid: rook-ceph-$cluster-1
ramendr.openshift.io/storageid: $name-$cluster-1
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
clusterID: rook-ceph
Expand Down

0 comments on commit 82a4836

Please sign in to comment.