Skip to content

Commit 0c55146

Browse files
committed
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>
1 parent d0003aa commit 0c55146

9 files changed

Lines changed: 284 additions & 0 deletions

File tree

PendingReleaseNotes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
## Features
66

7+
- helm: Support VolumeSnapshotClass and VolumeGroupSnapshotClass
8+
79
## NOTE
810

911
- `--setmetadata` flag has been set to true by default.

charts/ceph-csi-cephfs/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,22 @@ charts and their default values.
214214
| `storageClass.reclaimPolicy` | Specifies the reclaim policy of the StorageClass | `Delete` |
215215
| `storageClass.allowVolumeExpansion` | Specifies whether volume expansion should be allowed | `true` |
216216
| `storageClass.mountOptions` | Specifies the mount options | `[]` |
217+
| `volumeSnapshotClass.create` | Specifies whether the VolumeSnapshotClass should be created | `false` |
218+
| `volumeSnapshotClass.name` | Specifies the cephFS VolumeSnapshotClass name | `csi-cephfsplugin-snapclass` |
219+
| `volumeSnapshotClass.annotations` | Specifies the annotations for the cephFS volumeSnapshotClass | `[]` |
220+
| `volumeSnapshotClass.clusterID` | String representing a Ceph cluster to provision storage snapshot from | `<cluster-ID>` |
221+
| `volumeSnapshotClass.snapshotNamePrefix` | Prefix to use for naming CephFS snapshots | `""` |
222+
| `volumeSnapshotClass.snapshotterSecret` | The secrets have to contain user and/or Ceph admin credentials. | `csi-cephfs-secret` |
223+
| `volumeSnapshotClass.snapshotterSecretNamespace` | Specifies the snapshotter secret namespace | `""` |
224+
| `volumeSnapshotClass.deletionPolicy` | Specifies the deletion policy of the VolumeSnapshotClass | `Delete` |
225+
| `volumeGroupSnapshotClass.name` | Specifies the cephFS VolumeGroupSnapshotClass name | `csi-cephfsplugin-groupsnapclass` |
226+
| `volumeGroupSnapshotClass.annotations` | Specifies the annotations for the cephFS volumeGroupSnapshotClass | `[]` |
227+
| `volumeGroupSnapshotClass.clusterID` | String representing a Ceph cluster to provision storage group snapshot from | `<cluster-ID>` |
228+
| `volumeGroupSnapshotClass.fsName` | CephFS filesystem name into which the volume shall be created | `myfs` |
229+
| `volumeGroupSnapshotClass.volumeGroupNamePrefix` | Prefix to use for naming CephFS volumeGroups | `""` |
230+
| `volumeGroupSnapshotClass.groupSnapshotterSecret` | The secrets have to contain user and/or Ceph admin credentials. | `csi-cephfs-secret` |
231+
| `volumeGroupSnapshotClass.groupSnapshotterSecretNamespace` | Specifies the groupSnapshotter secret namespace | `""` |
232+
| `volumeGroupSnapshotClass.deletionPolicy` | Specifies the deletion policy of the VolumeGroupSnapshotClass | `Delete` |
217233
| `secret.create` | Specifies whether the secret should be created | `false` |
218234
| `secret.name` | Specifies the cephFS secret name | `csi-cephfs-secret` |
219235
| `secret.userID` | Specifies the user ID of the cephFS secret. | `""` |
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- if .Values.volumeGroupSnapshotClass.create -}}
2+
apiVersion: groupsnapshot.storage.k8s.io/v1beta1
3+
kind: VolumeGroupSnapshotClass
4+
metadata:
5+
name: {{ .Values.volumeGroupSnapshotClass.name }}
6+
{{- if .Values.volumeGroupSnapshotClass.annotations }}
7+
annotations:
8+
{{ toYaml .Values.volumeGroupSnapshotClass.annotations | indent 4 }}
9+
{{- end }}
10+
labels:
11+
app: {{ include "ceph-csi-cephfs.name" . }}
12+
chart: {{ include "ceph-csi-cephfs.chart" . }}
13+
release: {{ .Release.Name }}
14+
heritage: {{ .Release.Service }}
15+
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
16+
driver: {{ .Values.driverName }}
17+
parameters:
18+
clusterID: {{ .Values.volumeGroupSnapshotClass.clusterID }}
19+
fsName: {{ .Values.volumeGroupSnapshotClass.fsName }}
20+
{{- if .Values.volumeGroupSnapshotClass.volumeGroupNamePrefix }}
21+
volumeGroupNamePrefix: "{{ .Values.volumeGroupSnapshotClass.volumeGroupNamePrefix }}"
22+
{{- end }}
23+
csi.storage.k8s.io/group-snapshotter-secret-name: {{ .Values.volumeGroupSnapshotClass.groupSnapshotterSecret }}
24+
{{- if .Values.volumeGroupSnapshotClass.groupSnapshotterSecretNamespace }}
25+
csi.storage.k8s.io/group-snapshotter-secret-namespace: {{ .Values.volumeGroupSnapshotClass.groupSnapshotterSecretNamespace }}
26+
{{ else }}
27+
csi.storage.k8s.io/group-snapshotter-secret-namespace: {{ .Release.Namespace }}
28+
{{- end }}
29+
deletionPolicy: {{ .Values.volumeGroupSnapshotClass.deletionPolicy }}
30+
{{- end -}}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{- if .Values.volumeSnapshotClass.create -}}
2+
apiVersion: snapshot.storage.k8s.io/v1
3+
kind: VolumeSnapshotClass
4+
metadata:
5+
name: {{ .Values.volumeSnapshotClass.name }}
6+
{{- if .Values.volumeSnapshotClass.annotations }}
7+
annotations:
8+
{{ toYaml .Values.volumeSnapshotClass.annotations | indent 4 }}
9+
{{- end }}
10+
labels:
11+
app: {{ include "ceph-csi-cephfs.name" . }}
12+
chart: {{ include "ceph-csi-cephfs.chart" . }}
13+
release: {{ .Release.Name }}
14+
heritage: {{ .Release.Service }}
15+
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
16+
driver: {{ .Values.driverName }}
17+
parameters:
18+
clusterID: {{ .Values.volumeSnapshotClass.clusterID }}
19+
{{- if .Values.volumeSnapshotClass.snapshotNamePrefix }}
20+
snapshotNamePrefix: "{{ .Values.volumeSnapshotClass.snapshotNamePrefix }}"
21+
{{- end }}
22+
csi.storage.k8s.io/snapshotter-secret-name: {{ .Values.volumeSnapshotClass.snapshotterSecret }}
23+
{{- if .Values.volumeSnapshotClass.snapshotterSecretNamespace }}
24+
csi.storage.k8s.io/snapshotter-secret-namespace: {{ .Values.volumeSnapshotClass.snapshotterSecretNamespace }}
25+
{{ else }}
26+
csi.storage.k8s.io/snapshotter-secret-namespace: {{ .Release.Namespace }}
27+
{{- end }}
28+
deletionPolicy: {{ .Values.volumeSnapshotClass.deletionPolicy }}
29+
{{- end -}}

charts/ceph-csi-cephfs/values.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,71 @@ storageClass:
375375
# mountOptions:
376376
# - discard
377377

378+
volumeSnapshotClass:
379+
# Specifies whether the VolumeSnapshotClass should be created
380+
create: false
381+
name: csi-cephfsplugin-snapclass
382+
383+
# Annotations for the VolumeSnapshotClass
384+
# Example:
385+
# annotations:
386+
# storageclass.kubernetes.io/is-default-class: "true"
387+
annotations: {}
388+
389+
# String representing a Ceph cluster to provision storage snapshot from.
390+
# Should be unique across all Ceph clusters in use for provisioning,
391+
# cannot be greater than 36 bytes in length, and should remain immutable for
392+
# the lifetime of the VolumeSnapshotClass in use.
393+
# Ensure to create an entry in the configmap named ceph-csi-config, based on
394+
# csi-config-map-sample.yaml, to accompany the string chosen to
395+
# represent the Ceph cluster in clusterID below
396+
clusterID: <cluster-id>
397+
398+
# Prefix to use for naming CephFS snapshots.
399+
# If omitted, defaults to "csi-snap-".
400+
# snapshotNamePrefix: "foo-bar-"
401+
snapshotNamePrefix: ""
402+
403+
# The secrets have to contain user and/or Ceph admin credentials.
404+
snapshotterSecret: csi-cephfs-secret
405+
# If the Namespaces are not specified, the secrets are assumed to
406+
# be in the Release namespace.
407+
snapshotterSecretNamespace: ""
408+
409+
deletionPolicy: Delete
410+
411+
volumeGroupSnapshotClass:
412+
# Specifies whether the VolumeGroupSnapshotClass should be created
413+
create: false
414+
name: csi-cephfsplugin-groupsnapclass
415+
416+
# Annotations for the VolumeGroupSnapshotClass
417+
# Example:
418+
# annotations:
419+
# storageclass.kubernetes.io/is-default-class: "true"
420+
annotations: {}
421+
422+
# String representing a Ceph cluster to provision storage from.
423+
# Should be unique across all Ceph clusters in use for provisioning,
424+
# cannot be greater than 36 bytes in length, and should remain immutable for
425+
# the lifetime of the VolumeGroupSnapshotClass in use
426+
clusterID: <cluster-id>
427+
428+
# eg: fsName: myfs
429+
fsName: myfs
430+
431+
# (optional) Prefix to use for naming RBD groups.
432+
# If omitted, defaults to "csi-vol-group-".
433+
volumeGroupNamePrefix: ""
434+
435+
# The secrets have to contain user and/or Ceph admin credentials.
436+
groupSnapshotterSecret: csi-cephfs-secret
437+
# If the Namespaces are not specified, the secrets are assumed to
438+
# be in the Release namespace.
439+
groupSnapshotterSecretNamespace: ""
440+
441+
deletionPolicy: Delete
442+
378443
secret:
379444
# Specifies whether the secret should be created
380445
create: false

0 commit comments

Comments
 (0)