blob: 35c6e72003d6f5ffaa047df2b10901c80e6234cd [file] [log] [blame] [edit]
{{- $root := . -}}
{{- range $filesystem := .Values.cephFileSystems -}}
---
apiVersion: ceph.rook.io/v1
kind: CephFilesystemSubVolumeGroup
metadata:
name: {{ $filesystem.name }}-csi # lets keep the svg crd name same as `filesystem name + csi` for the default csi svg
namespace: {{ $root.Release.Namespace }} # namespace:cluster
spec:
# The name of the subvolume group. If not set, the default is the name of the subvolumeGroup CR.
name: csi
# filesystemName is the metadata name of the CephFilesystem CR where the subvolume group will be created
filesystemName: {{ $filesystem.name }}
# reference https://docs.ceph.com/en/latest/cephfs/fs-volumes/#pinning-subvolumes-and-subvolume-groups
# only one out of (export, distributed, random) can be set at a time
# by default pinning is set with value: distributed=1
# for disabling default values set (distributed=0)
pinning:
distributed: 1 # distributed=<0, 1> (disabled=0)
# export: # export=<0-256> (disabled=-1)
# random: # random=[0.0, 1.0](disabled=0.0)
---
apiVersion: ceph.rook.io/v1
kind: CephFilesystem
metadata:
name: {{ $filesystem.name }}
namespace: {{ $root.Release.Namespace }} # namespace:cluster
spec:
{{ toYaml $filesystem.spec | indent 2 }}
---
{{- if default false $filesystem.storageClass.enabled }}
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ $filesystem.storageClass.name }}
annotations:
storageclass.kubernetes.io/is-default-class: "{{ if default false $filesystem.storageClass.isDefault }}true{{ else }}false{{ end }}"
{{- if $root.Values.csiDriverNamePrefix }}
provisioner: {{ $root.Values.csiDriverNamePrefix }}.cephfs.csi.ceph.com
{{- else }}
provisioner: {{ $root.Values.operatorNamespace }}.cephfs.csi.ceph.com
{{- end }}
parameters:
fsName: {{ $filesystem.name }}
pool: {{ $filesystem.name }}-{{ default "data0" $filesystem.storageClass.pool }}
clusterID: {{ $root.Release.Namespace }}
{{ with $filesystem.storageClass.parameters }}
{{ tpl (toYaml .) $ | indent 2 }}
{{ end }}
reclaimPolicy: {{ default "Delete" $filesystem.storageClass.reclaimPolicy }}
allowVolumeExpansion: {{ default "true" $filesystem.storageClass.allowVolumeExpansion }}
volumeBindingMode: {{ default "Immediate" $filesystem.storageClass.volumeBindingMode }}
{{- if $filesystem.storageClass.mountOptions }}
mountOptions:
{{- range $filesystem.storageClass.mountOptions }}
- {{ . }}
{{- end }}
{{- end }}
{{ end }}
{{ end }}