platform-armada-app/platform-helm/debian/deb_folder/patches/0016-ceph-csi-rbd-add-snapshotclass.patch
Gabriel de Araújo Cabral 313c3b1d1d Add SnapshotClass Creation for CephFS/RBD via Helm Override
This commit  introduces the capability to create a snapshot
class using helm overrides within "cephfs-provisioner"
and "rbd-provisioner" charts.

By default, upon applying platform-integ-apps the
'snapshotClass.create' field is set to 'false' in both charts,
creating the snapshot class(es) after being changed to 'true' via
helm overrides and the app reapplied.

This enhancement depends on the changes from the review below,
where in each installation the CRDs and the snapshot-controller
will be created by default when running bootstrap playbook.
This way, each CSI app will be able to implement this functionality
as support for PVC snapshots will be default during installations.

* This is a new review after the revert of:
https://review.opendev.org/c/starlingx/platform-armada-app/+/902722

Test Plan:
 PASS: Build a new app package with the code changes
 PASS: Successfully execute upload, apply, remove, and delete
       operations for 'platform-integ-apps' on both AIO-SX and
       AIO-DX environments.
 PASS: Upon initial application apply and update, check with
       'helm get values' that the 'snapshotClass.create' field
       is set to 'false' in both the cephFS and RBD charts.
       Additionally, confirm on K8s that the snapshotClasses are not
       created, as expected
 PASS: Use 'system helm-override-update' to change the
       'snapshotClass.create' field to 'true' in both charts.
       Reapply the app and validate on K8s that the snapshotClasses
       are indeed created.
 PASS: After creating the SnapshotClass, take a VolumeSnapshot
       from an existing PVC, proceed with K8s upgrade (K8s 1.25,
       1.26, and 1.27) with CRDs and snapshot controller update,
       take a VolumeSnapshot from another PVC and verify that
       all VolumeSnapshots are correct
 PASS: With an old version of the application, create user overrides
       for 'classes', then update to the application with the
       current changes and verify that the user overrides for
       'classes' have been transferred to 'storageClasses'

Partial-Bug: 2045897

Depends-on: https://review.opendev.org/c/starlingx/ansible-playbooks/+/904360

Change-Id: I6e2fe2009d4cce3e351142359c1f36465cf03ee3
Signed-off-by: Gabriel de Araújo Cabral <gabriel.cabral@windriver.com>
Signed-off-by: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
2024-01-08 12:45:54 -03:00

63 lines
2.3 KiB
Diff

From d6dbc163f3be00789a74f85556de4486792f9d72 Mon Sep 17 00:00:00 2001
From: Gabriel de Araújo Cabral <gabriel.cabral@windriver.com>
Date: Thu, 30 Nov 2023 13:38:09 -0300
Subject: ceph-csi-rbd: add snapshotclass
Signed-off-by: Gabriel de Araújo Cabral <gabriel.cabral@windriver.com>
---
.../ceph-csi-rbd/templates/snapshotclass.yaml | 13 +++++++++++++
charts/ceph-csi-rbd/values.yaml | 18 ++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100644 charts/ceph-csi-rbd/templates/snapshotclass.yaml
diff --git a/charts/ceph-csi-rbd/templates/snapshotclass.yaml b/charts/ceph-csi-rbd/templates/snapshotclass.yaml
new file mode 100644
index 000000000..3bad19026
--- /dev/null
+++ b/charts/ceph-csi-rbd/templates/snapshotclass.yaml
@@ -0,0 +1,13 @@
+{{- if .Values.snapshotClass.create -}}
+apiVersion: snapshot.storage.k8s.io/v1
+kind: VolumeSnapshotClass
+metadata:
+ name: {{ .Values.snapshotClass.name }}
+driver: {{ .Values.driverName }}
+parameters:
+ clusterID: {{ .Values.snapshotClass.clusterID }}
+ snapshotNamePrefix: {{ .Values.snapshotClass.snapshotNamePrefix }}
+ csi.storage.k8s.io/snapshotter-secret-name: {{ .Values.snapshotClass.provisionerSecret }}
+ csi.storage.k8s.io/snapshotter-secret-namespace: {{ .Values.snapshotClass.provisionerSecretNamespace }}
+deletionPolicy: {{ .Values.snapshotClass.deletionPolicy }}
+{{- end -}}
diff --git a/charts/ceph-csi-rbd/values.yaml b/charts/ceph-csi-rbd/values.yaml
index c33d5f2a6..8dd9ea3d5 100644
--- a/charts/ceph-csi-rbd/values.yaml
+++ b/charts/ceph-csi-rbd/values.yaml
@@ -449,6 +449,24 @@ storageClass:
# selinux-enabled filesystems
selinuxMount: true
+snapshotClass:
+ # Specifies whether the snapshotclass should be created
+ create: false
+ # Specifies the snapshotclass name
+ name: csi-rbdplugin-snapclass
+ # (required) Unique string representing a Ceph cluster to provision
+ #storage from.
+ clusterID: <cluster-ID>
+ # Prefix to use for naming RBD snapshots.
+ # If omitted, defaults to "csi-snap-".
+ # snapshotNamePrefix: "foo-bar-"
+ snapshotNamePrefix: ""
+ # K8s secret name
+ provisionerSecret: csi-rbd-secret
+ # K8s secret namespace
+ provisionerSecretNamespace: ""
+ deletionPolicy: Delete
+
secret:
# Specifies whether the secret should be created
create: false
--
2.25.1