{{- if .Values.cluster.storageClass.enabled }}
apiVersion: {{ if .Capabilities.APIVersions.Has "storage.k8s.io/v1" -}}
  storage.k8s.io/v1
{{- else -}}
  storage.k8s.io/v1beta1
{{- end }}
kind: StorageClass
metadata:
  labels:
    app: "{{ template "rethinkdb.name" . }}-cluster"
    chart: {{ template "rethinkdb.chart" . }}
    heritage: {{ .Release.Service | quote }}
    release: {{ .Release.Name | quote }}
  name: {{ template "rethinkdb.fullname" . }}
provisioner: {{ .Values.cluster.storageClass.provisioner }}
parameters:
{{- range $key, $value := .Values.cluster.storageClass.parameters }}
  {{ $key }}: {{ $value }}
{{- end }}
{{- end }}
