From 307a2f130b25ec4933bffc503fedd56343562da1 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 4 Apr 2024 11:59:41 +0200 Subject: [PATCH 1/2] ci: add volumesnapshotclasses for externalstorage added volumesnapshotclasses yaml and script for external-storage test Signed-off-by: Madhu Rajanna --- scripts/k8s-storage/README.md | 6 ++++- .../create-volumesnapshotclasses.sh | 27 +++++++++++++++++++ .../volumesnapshotclass-cephfs.yaml.in | 11 ++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100755 scripts/k8s-storage/create-volumesnapshotclasses.sh create mode 100644 scripts/k8s-storage/volumesnapshotclass-cephfs.yaml.in diff --git a/scripts/k8s-storage/README.md b/scripts/k8s-storage/README.md index a26e2f65ae7..b48b66024d2 100644 --- a/scripts/k8s-storage/README.md +++ b/scripts/k8s-storage/README.md @@ -5,9 +5,13 @@ This job runs the [Kubernetes end-to-end external storage tests][1] with different driver configurations/manifests (in the `driver-*.yaml` files). Each driver configuration refers to a StorageClass that is used while testing. -The StorageClasses are created with the `create-storageclass.sh` script and the +The StorageClasses are created with the `create-storageclasses.sh` script and the `sc-*.yaml.in` templates. +The VolumeSnapshotClasses are created with the +`create-volumesnapshotclasses.sh` script and the +`volumesnapshotclass-*.yaml.in` templates. + The Ceph-CSI Configuration from the `ceph-csi-config` ConfigMap is created with `create-configmap.sh` after the deployment is finished. The ConfigMap is referenced in the StorageClasses and contains the connection details for the diff --git a/scripts/k8s-storage/create-volumesnapshotclasses.sh b/scripts/k8s-storage/create-volumesnapshotclasses.sh new file mode 100755 index 00000000000..2388e6fe4bd --- /dev/null +++ b/scripts/k8s-storage/create-volumesnapshotclasses.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Create VolumeSnapshotClasses from a template (volumesnapshotclass-*.yaml.in) and replace keywords +# like @@CLUSTER_ID@@. +# +# These VolumeSnapshotClasses can then be used by driver-*.yaml manifests in the +# k8s-e2e-external-storage CI job. +# +# Requirements: +# - kubectl in the path +# - working KUBE_CONFIG either in environment, or default config files +# - deployment done with Rook +# + +# exit on error +set -e + +WORKDIR=$(dirname "${0}") + +TOOLBOX_POD=$(kubectl -n rook-ceph get pods --no-headers -l app=rook-ceph-tools -o=jsonpath='{.items[0].metadata.name}') +FS_ID=$(kubectl -n rook-ceph exec "${TOOLBOX_POD}" -- ceph fsid) + +for sc in "${WORKDIR}"/volumesnapshotclass-*.yaml.in +do + sed "s/@@CLUSTER_ID@@/${FS_ID}/" "${sc}" | + kubectl create -f - +done diff --git a/scripts/k8s-storage/volumesnapshotclass-cephfs.yaml.in b/scripts/k8s-storage/volumesnapshotclass-cephfs.yaml.in new file mode 100644 index 00000000000..87a2a4652ab --- /dev/null +++ b/scripts/k8s-storage/volumesnapshotclass-cephfs.yaml.in @@ -0,0 +1,11 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotClass +metadata: + name: k8s-storage-e2e-cephfs +driver: cephfs.csi.ceph.com +parameters: + clusterID: @@CLUSTER_ID@@ + csi.storage.k8s.io/snapshotter-secret-name: rook-csi-cephfs-provisioner + csi.storage.k8s.io/snapshotter-secret-namespace: rook-ceph +deletionPolicy: Delete From 9fb374328077daf791526b1e48f5c07cbf84db34 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 4 Apr 2024 12:30:02 +0200 Subject: [PATCH 2/2] ci: fix secret name in rbd storageclass use rbd secret for rbd storageclass Signed-off-by: Madhu Rajanna --- scripts/k8s-storage/sc-rbd.yaml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/k8s-storage/sc-rbd.yaml.in b/scripts/k8s-storage/sc-rbd.yaml.in index 92f2775b888..c3d09d161ae 100644 --- a/scripts/k8s-storage/sc-rbd.yaml.in +++ b/scripts/k8s-storage/sc-rbd.yaml.in @@ -10,7 +10,7 @@ parameters: imageFeatures: layering csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-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-name: rook-csi-rbd-provisioner csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph