From 10089bc54cafc4c789383ba07ad978ff6ab88560 Mon Sep 17 00:00:00 2001 From: rakeshgm Date: Wed, 30 Oct 2024 20:54:18 +0530 Subject: [PATCH] adding storageID and replicationID to classes add storageID, replicationID to StorageClass, replicationClasses and snapshotClasses. this is to faciltate filtering of multiple storageClasses Signed-off-by: rakeshgm --- test/addons/rbd-mirror/start | 5 ++++ .../rbd-mirror/start-data/kustomization.yaml | 1 - .../rbd-mirror/start-data/vrc-sample.yaml | 3 +++ test/addons/rook-cephfs/cache | 10 ------- test/addons/rook-cephfs/kustomization.yaml | 9 ------- test/addons/rook-cephfs/snapshot-class.yaml | 20 ++++++++++++++ test/addons/rook-cephfs/start | 17 +++++++++--- test/addons/rook-cephfs/storage-class.yaml | 27 +++++++++++++++++++ test/addons/rook-pool/snapshot-class.yaml | 2 ++ test/addons/rook-pool/start | 14 +++++----- 10 files changed, 78 insertions(+), 30 deletions(-) delete mode 100755 test/addons/rook-cephfs/cache delete mode 100644 test/addons/rook-cephfs/kustomization.yaml create mode 100644 test/addons/rook-cephfs/snapshot-class.yaml create mode 100644 test/addons/rook-cephfs/storage-class.yaml diff --git a/test/addons/rbd-mirror/start b/test/addons/rbd-mirror/start index 732641207..ab8028a4d 100755 --- a/test/addons/rbd-mirror/start +++ b/test/addons/rbd-mirror/start @@ -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) diff --git a/test/addons/rbd-mirror/start-data/kustomization.yaml b/test/addons/rbd-mirror/start-data/kustomization.yaml index a3d38214e..1a51e23cc 100644 --- a/test/addons/rbd-mirror/start-data/kustomization.yaml +++ b/test/addons/rbd-mirror/start-data/kustomization.yaml @@ -3,7 +3,6 @@ --- resources: -- vrc-sample.yaml - vgrc-sample.yaml - rbd-mirror.yaml diff --git a/test/addons/rbd-mirror/start-data/vrc-sample.yaml b/test/addons/rbd-mirror/start-data/vrc-sample.yaml index ba6c34da5..bfdcd1395 100644 --- a/test/addons/rbd-mirror/start-data/vrc-sample.yaml +++ b/test/addons/rbd-mirror/start-data/vrc-sample.yaml @@ -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: diff --git a/test/addons/rook-cephfs/cache b/test/addons/rook-cephfs/cache deleted file mode 100755 index d513d00a1..000000000 --- a/test/addons/rook-cephfs/cache +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 - -# SPDX-FileCopyrightText: The RamenDR authors -# SPDX-License-Identifier: Apache-2.0 - -import os -from drenv import cache - -os.chdir(os.path.dirname(__file__)) -cache.refresh(".", "addons/rook-cephfs-1.15.yaml") diff --git a/test/addons/rook-cephfs/kustomization.yaml b/test/addons/rook-cephfs/kustomization.yaml deleted file mode 100644 index db7bf0840..000000000 --- a/test/addons/rook-cephfs/kustomization.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-FileCopyrightText: The RamenDR authors -# SPDX-License-Identifier: Apache-2.0 - -# yamllint disable rule:line-length ---- -resources: - - filesystem.yaml - - https://raw.githubusercontent.com/rook/rook/release-1.15/deploy/examples/csi/cephfs/storageclass.yaml - - https://raw.githubusercontent.com/rook/rook/release-1.15/deploy/examples/csi/cephfs/snapshotclass.yaml diff --git a/test/addons/rook-cephfs/snapshot-class.yaml b/test/addons/rook-cephfs/snapshot-class.yaml new file mode 100644 index 000000000..7d2161b4e --- /dev/null +++ b/test/addons/rook-cephfs/snapshot-class.yaml @@ -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 diff --git a/test/addons/rook-cephfs/start b/test/addons/rook-cephfs/start index ea38bc690..ba6407247 100755 --- a/test/addons/rook-cephfs/start +++ b/test/addons/rook-cephfs/start @@ -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): diff --git a/test/addons/rook-cephfs/storage-class.yaml b/test/addons/rook-cephfs/storage-class.yaml new file mode 100644 index 000000000..39a4652fe --- /dev/null +++ b/test/addons/rook-cephfs/storage-class.yaml @@ -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 diff --git a/test/addons/rook-pool/snapshot-class.yaml b/test/addons/rook-pool/snapshot-class.yaml index ed2f5dbc4..0b188b700 100644 --- a/test/addons/rook-pool/snapshot-class.yaml +++ b/test/addons/rook-pool/snapshot-class.yaml @@ -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 diff --git a/test/addons/rook-pool/start b/test/addons/rook-pool/start index b06b5ca2e..cf31e2878 100755 --- a/test/addons/rook-pool/start +++ b/test/addons/rook-pool/start @@ -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):