helm: Support VolumeSnapshotClass and VolumeGroupSnapshotClass

This PR add support for creating VolumeSnapshotClass and
VolumeGroupSnapshotClass with helm charts. Both default with
`create: false` as StorageClass support.

Moreover, it handle the chart release with branch `gh-pages`, by
integrate with <https://github.com/helm/chart-releaser-action>.

The sample helm repo could find from
<https://alvistack.github.io/ceph-ceph-csi/index.yaml>, by:

    helm repo add ceph-csi https://alvistack.github.io/ceph-ceph-csi
    helm repo update
    helm search repo ceph-csi

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
This commit is contained in:
Wong Hoi Sing Edison 2025-04-10 18:19:32 +08:00
parent 73579f94c7
commit dd3139dfb1
No known key found for this signature in database
GPG Key ID: 0F0D6A60644E28D3
9 changed files with 284 additions and 0 deletions

View File

@ -4,4 +4,6 @@
## Features
- helm: Support VolumeSnapshotClass and VolumeGroupSnapshotClass
## NOTE

View File

@ -214,6 +214,22 @@ charts and their default values.
| `storageClass.reclaimPolicy` | Specifies the reclaim policy of the StorageClass | `Delete` |
| `storageClass.allowVolumeExpansion` | Specifies whether volume expansion should be allowed | `true` |
| `storageClass.mountOptions` | Specifies the mount options | `[]` |
| `volumeSnapshotClass.create` | Specifies whether the VolumeSnapshotClass should be created | `false` |
| `volumeSnapshotClass.name` | Specifies the cephFS VolumeSnapshotClass name | `csi-cephfsplugin-snapclass` |
| `volumeSnapshotClass.annotations` | Specifies the annotations for the cephFS volumeSnapshotClass | `[]` |
| `volumeSnapshotClass.clusterID` | String representing a Ceph cluster to provision storage snapshot from | `<cluster-ID>` |
| `volumeSnapshotClass.snapshotNamePrefix` | Prefix to use for naming CephFS snapshots | `""` |
| `volumeSnapshotClass.snapshotterSecret` | The secrets have to contain user and/or Ceph admin credentials. | `csi-cephfs-secret` |
| `volumeSnapshotClass.snapshotterSecretNamespace` | Specifies the snapshotter secret namespace | `""` |
| `volumeSnapshotClass.deletionPolicy` | Specifies the deletion policy of the VolumeSnapshotClass | `Delete` |
| `volumeGroupSnapshotClass.name` | Specifies the cephFS VolumeGroupSnapshotClass name | `csi-cephfsplugin-groupsnapclass` |
| `volumeGroupSnapshotClass.annotations` | Specifies the annotations for the cephFS volumeGroupSnapshotClass | `[]` |
| `volumeGroupSnapshotClass.clusterID` | String representing a Ceph cluster to provision storage group snapshot from | `<cluster-ID>` |
| `volumeGroupSnapshotClass.fsName` | CephFS filesystem name into which the volume shall be created | `myfs` |
| `volumeGroupSnapshotClass.volumeGroupNamePrefix` | Prefix to use for naming CephFS volumeGroups | `""` |
| `volumeGroupSnapshotClass.groupSnapshotterSecret` | The secrets have to contain user and/or Ceph admin credentials. | `csi-cephfs-secret` |
| `volumeGroupSnapshotClass.groupSnapshotterSecretNamespace` | Specifies the groupSnapshotter secret namespace | `""` |
| `volumeGroupSnapshotClass.deletionPolicy` | Specifies the deletion policy of the VolumeGroupSnapshotClass | `Delete` |
| `secret.create` | Specifies whether the secret should be created | `false` |
| `secret.name` | Specifies the cephFS secret name | `csi-cephfs-secret` |
| `secret.userID` | Specifies the user ID of the cephFS secret. | `""` |

View File

@ -0,0 +1,30 @@
{{- if .Values.volumeGroupSnapshotClass.create -}}
apiVersion: groupsnapshot.storage.k8s.io/v1beta1
kind: VolumeGroupSnapshotClass
metadata:
name: {{ .Values.volumeGroupSnapshotClass.name }}
{{- if .Values.volumeGroupSnapshotClass.annotations }}
annotations:
{{ toYaml .Values.volumeGroupSnapshotClass.annotations | indent 4 }}
{{- end }}
labels:
app: {{ include "ceph-csi-cephfs.name" . }}
chart: {{ include "ceph-csi-cephfs.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
driver: {{ .Values.driverName }}
parameters:
clusterID: {{ .Values.volumeGroupSnapshotClass.clusterID }}
fsName: {{ .Values.volumeGroupSnapshotClass.fsName }}
{{- if .Values.volumeGroupSnapshotClass.volumeGroupNamePrefix }}
volumeGroupNamePrefix: "{{ .Values.volumeGroupSnapshotClass.volumeGroupNamePrefix }}"
{{- end }}
csi.storage.k8s.io/group-snapshotter-secret-name: {{ .Values.volumeGroupSnapshotClass.groupSnapshotterSecret }}
{{- if .Values.volumeGroupSnapshotClass.groupSnapshotterSecretNamespace }}
csi.storage.k8s.io/group-snapshotter-secret-namespace: {{ .Values.volumeGroupSnapshotClass.groupSnapshotterSecretNamespace }}
{{ else }}
csi.storage.k8s.io/group-snapshotter-secret-namespace: {{ .Release.Namespace }}
{{- end }}
deletionPolicy: {{ .Values.volumeGroupSnapshotClass.deletionPolicy }}
{{- end -}}

View File

@ -0,0 +1,29 @@
{{- if .Values.volumeSnapshotClass.create -}}
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: {{ .Values.volumeSnapshotClass.name }}
{{- if .Values.volumeSnapshotClass.annotations }}
annotations:
{{ toYaml .Values.volumeSnapshotClass.annotations | indent 4 }}
{{- end }}
labels:
app: {{ include "ceph-csi-cephfs.name" . }}
chart: {{ include "ceph-csi-cephfs.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
driver: {{ .Values.driverName }}
parameters:
clusterID: {{ .Values.volumeSnapshotClass.clusterID }}
{{- if .Values.volumeSnapshotClass.snapshotNamePrefix }}
snapshotNamePrefix: "{{ .Values.volumeSnapshotClass.snapshotNamePrefix }}"
{{- end }}
csi.storage.k8s.io/snapshotter-secret-name: {{ .Values.volumeSnapshotClass.snapshotterSecret }}
{{- if .Values.volumeSnapshotClass.snapshotterSecretNamespace }}
csi.storage.k8s.io/snapshotter-secret-namespace: {{ .Values.volumeSnapshotClass.snapshotterSecretNamespace }}
{{ else }}
csi.storage.k8s.io/snapshotter-secret-namespace: {{ .Release.Namespace }}
{{- end }}
deletionPolicy: {{ .Values.volumeSnapshotClass.deletionPolicy }}
{{- end -}}

View File

@ -375,6 +375,71 @@ storageClass:
# mountOptions:
# - discard
volumeSnapshotClass:
# Specifies whether the VolumeSnapshotClass should be created
create: false
name: csi-cephfsplugin-snapclass
# Annotations for the VolumeSnapshotClass
# Example:
# annotations:
# storageclass.kubernetes.io/is-default-class: "true"
annotations: {}
# String representing a Ceph cluster to provision storage snapshot from.
# Should be unique across all Ceph clusters in use for provisioning,
# cannot be greater than 36 bytes in length, and should remain immutable for
# the lifetime of the VolumeSnapshotClass in use.
# Ensure to create an entry in the configmap named ceph-csi-config, based on
# csi-config-map-sample.yaml, to accompany the string chosen to
# represent the Ceph cluster in clusterID below
clusterID: <cluster-id>
# Prefix to use for naming CephFS snapshots.
# If omitted, defaults to "csi-snap-".
# snapshotNamePrefix: "foo-bar-"
snapshotNamePrefix: ""
# The secrets have to contain user and/or Ceph admin credentials.
snapshotterSecret: csi-cephfs-secret
# If the Namespaces are not specified, the secrets are assumed to
# be in the Release namespace.
snapshotterSecretNamespace: ""
deletionPolicy: Delete
volumeGroupSnapshotClass:
# Specifies whether the VolumeGroupSnapshotClass should be created
create: false
name: csi-cephfsplugin-groupsnapclass
# Annotations for the VolumeGroupSnapshotClass
# Example:
# annotations:
# storageclass.kubernetes.io/is-default-class: "true"
annotations: {}
# String representing a Ceph cluster to provision storage from.
# Should be unique across all Ceph clusters in use for provisioning,
# cannot be greater than 36 bytes in length, and should remain immutable for
# the lifetime of the VolumeGroupSnapshotClass in use
clusterID: <cluster-id>
# eg: fsName: myfs
fsName: myfs
# (optional) Prefix to use for naming RBD groups.
# If omitted, defaults to "csi-vol-group-".
volumeGroupNamePrefix: ""
# The secrets have to contain user and/or Ceph admin credentials.
groupSnapshotterSecret: csi-cephfs-secret
# If the Namespaces are not specified, the secrets are assumed to
# be in the Release namespace.
groupSnapshotterSecretNamespace: ""
deletionPolicy: Delete
secret:
# Specifies whether the secret should be created
create: false

View File

@ -212,6 +212,22 @@ charts and their default values.
| `storageClass.reclaimPolicy` | Specifies the reclaim policy of the StorageClass | `Delete` |
| `storageClass.allowVolumeExpansion` | Specifies whether volume expansion should be allowed | `true` |
| `storageClass.mountOptions` | Specifies the mount options for storageClass | `[]` |
| `volumeSnapshotClass.create` | Specifies whether the VolumeSnapshotClass should be created | `false` |
| `volumeSnapshotClass.name` | Specifies the rbd VolumeSnapshotClass name | `csi-rbdplugin-snapclass` |
| `volumeSnapshotClass.annotations` | Specifies the annotations for the rbd volumeSnapshotClass | `[]` |
| `volumeSnapshotClass.clusterID` | String representing a Ceph cluster to provision storage snapshot from | `<cluster-ID>` |
| `volumeSnapshotClass.snapshotNamePrefix` | Prefix to use for naming RBD snapshots | `""` |
| `volumeSnapshotClass.snapshotterSecret` | The secrets have to contain user and/or Ceph admin credentials. | `csi-rbd-secret` |
| `volumeSnapshotClass.snapshotterSecretNamespace` | Specifies the snapshotter secret namespace | `""` |
| `volumeSnapshotClass.deletionPolicy` | Specifies the deletion policy of the VolumeSnapshotClass | `Delete` |
| `volumeGroupSnapshotClass.name` | Specifies the rbd VolumeGroupSnapshotClass name | `csi-rbdplugin-groupsnapclass` |
| `volumeGroupSnapshotClass.annotations` | Specifies the annotations for the rbd volumeGroupSnapshotClass | `[]` |
| `volumeGroupSnapshotClass.clusterID` | String representing a Ceph cluster to provision storage group snapshot from | `<cluster-ID>` |
| `volumeGroupSnapshotClass.pool` | Ceph pool into which the RBD group shall be created | `replicapool` |
| `volumeGroupSnapshotClass.volumeGroupNamePrefix` | Prefix to use for naming RBD volumeGroups | `""` |
| `volumeGroupSnapshotClass.groupSnapshotterSecret` | The secrets have to contain user and/or Ceph admin credentials. | `csi-rbd-secret` |
| `volumeGroupSnapshotClass.groupSnapshotterSecretNamespace` | Specifies the groupSnapshotter secret namespace | `""` |
| `volumeGroupSnapshotClass.deletionPolicy` | Specifies the deletion policy of the VolumeGroupSnapshotClass | `Delete` |
| `secret.create` | Specifies whether the secret should be created | `false` |
| `secret.name` | Specifies the rbd secret name | `csi-rbd-secret` |
| `secret.userID` | Specifies the user ID of the rbd secret | `<plaintext ID>` |

View File

@ -0,0 +1,30 @@
{{- if .Values.volumeGroupSnapshotClass.create -}}
apiVersion: groupsnapshot.storage.k8s.io/v1beta1
kind: VolumeGroupSnapshotClass
metadata:
name: {{ .Values.volumeGroupSnapshotClass.name }}
{{- if .Values.volumeGroupSnapshotClass.annotations }}
annotations:
{{ toYaml .Values.volumeGroupSnapshotClass.annotations | indent 4 }}
{{- end }}
labels:
app: {{ include "ceph-csi-rbd.name" . }}
chart: {{ include "ceph-csi-rbd.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
driver: {{ .Values.driverName }}
parameters:
clusterID: {{ .Values.volumeGroupSnapshotClass.clusterID }}
pool: {{ .Values.volumeGroupSnapshotClass.pool }}
{{- if .Values.volumeGroupSnapshotClass.volumeGroupNamePrefix }}
volumeGroupNamePrefix: "{{ .Values.volumeGroupSnapshotClass.volumeGroupNamePrefix }}"
{{- end }}
csi.storage.k8s.io/group-snapshotter-secret-name: {{ .Values.volumeGroupSnapshotClass.groupSnapshotterSecret }}
{{- if .Values.volumeGroupSnapshotClass.groupSnapshotterSecretNamespace }}
csi.storage.k8s.io/group-snapshotter-secret-namespace: {{ .Values.volumeGroupSnapshotClass.groupSnapshotterSecretNamespace }}
{{ else }}
csi.storage.k8s.io/group-snapshotter-secret-namespace: {{ .Release.Namespace }}
{{- end }}
deletionPolicy: {{ .Values.volumeGroupSnapshotClass.deletionPolicy }}
{{- end -}}

View File

@ -0,0 +1,29 @@
{{- if .Values.volumeSnapshotClass.create -}}
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: {{ .Values.volumeSnapshotClass.name }}
{{- if .Values.volumeSnapshotClass.annotations }}
annotations:
{{ toYaml .Values.volumeSnapshotClass.annotations | indent 4 }}
{{- end }}
labels:
app: {{ include "ceph-csi-rbd.name" . }}
chart: {{ include "ceph-csi-rbd.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
driver: {{ .Values.driverName }}
parameters:
clusterID: {{ .Values.volumeSnapshotClass.clusterID }}
{{- if .Values.volumeSnapshotClass.snapshotNamePrefix }}
snapshotNamePrefix: "{{ .Values.volumeSnapshotClass.snapshotNamePrefix }}"
{{- end }}
csi.storage.k8s.io/snapshotter-secret-name: {{ .Values.volumeSnapshotClass.snapshotterSecret }}
{{- if .Values.volumeSnapshotClass.snapshotterSecretNamespace }}
csi.storage.k8s.io/snapshotter-secret-namespace: {{ .Values.volumeSnapshotClass.snapshotterSecretNamespace }}
{{ else }}
csi.storage.k8s.io/snapshotter-secret-namespace: {{ .Release.Namespace }}
{{- end }}
deletionPolicy: {{ .Values.volumeSnapshotClass.deletionPolicy }}
{{- end -}}

View File

@ -526,6 +526,73 @@ storageClass:
# mountOptions:
# - discard
volumeSnapshotClass:
# Specifies whether the VolumeSnapshotClass should be created
create: false
name: csi-rbdplugin-snapclass
# Annotations for the VolumeSnapshotClass
# Example:
# annotations:
# storageclass.kubernetes.io/is-default-class: "true"
annotations: {}
# String representing a Ceph cluster to provision storage snapshot from.
# Should be unique across all Ceph clusters in use for provisioning,
# cannot be greater than 36 bytes in length, and should remain immutable for
# the lifetime of the VolumeSnapshotClass in use.
# Ensure to create an entry in the configmap named ceph-csi-config, based on
# csi-config-map-sample.yaml, to accompany the string chosen to
# represent the Ceph cluster in clusterID below
clusterID: <cluster-id>
# Prefix to use for naming CephFS snapshots.
# If omitted, defaults to "csi-snap-".
# snapshotNamePrefix: "foo-bar-"
snapshotNamePrefix: ""
# The secrets have to contain user and/or Ceph admin credentials.
snapshotterSecret: csi-rbd-secret
# If the Namespaces are not specified, the secrets are assumed to
# be in the Release namespace.
snapshotterSecretNamespace: ""
deletionPolicy: Delete
volumeGroupSnapshotClass:
# Specifies whether the VolumeGroupSnapshotClass should be created
create: false
name: csi-rbdplugin-groupsnapclass
# Annotations for the VolumeGroupSnapshotClass
# Example:
# annotations:
# storageclass.kubernetes.io/is-default-class: "true"
annotations: {}
# String representing a Ceph cluster to provision storage from.
# Should be unique across all Ceph clusters in use for provisioning,
# cannot be greater than 36 bytes in length, and should remain immutable for
# the lifetime of the VolumeGroupSnapshotClass in use
clusterID: <cluster-id>
# (required) Ceph pool into which the RBD image shall be created
# (optional) if topologyConstrainedPools is provided
# eg: pool: replicapool
pool: replicapool
# (optional) Prefix to use for naming RBD groups.
# If omitted, defaults to "csi-vol-group-".
volumeGroupNamePrefix: ""
# The secrets have to contain user and/or Ceph admin credentials.
groupSnapshotterSecret: csi-rbd-secret
# If the Namespaces are not specified, the secrets are assumed to
# be in the Release namespace.
groupSnapshotterSecretNamespace: ""
deletionPolicy: Delete
# Mount the host /etc/selinux inside pods to support
# selinux-enabled filesystems
selinuxMount: true