{{ if .Values.storageClasses.default.create -}}
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: {{ .Values.storageClasses.default.name }}
  labels:
    chart: {{ template "gerrit-replica.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    {{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels  | indent 4 }}
    {{- end }}
provisioner: {{ .Values.storageClasses.default.provisioner }}
reclaimPolicy: {{ .Values.storageClasses.default.reclaimPolicy }}
{{ if .Values.storageClasses.default.parameters -}}
parameters:
{{- range $key, $value := .Values.storageClasses.default.parameters }}
  {{ $key }}: {{ $value }}
{{- end }}
{{ if .Values.storageClasses.default.mountOptions -}}
mountOptions:
{{- range .Values.storageClasses.default.mountOptions }}
  - {{ . }}
{{- end }}
{{- end }}
allowVolumeExpansion: {{ .Values.storageClasses.default.allowVolumeExpansion }}
{{- end }}
{{- end }}
---
{{ if .Values.storageClasses.shared.create -}}
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: {{ .Values.storageClasses.shared.name }}
  labels:
    chart: {{ template "gerrit-replica.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    {{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels  | indent 4 }}
    {{- end }}
provisioner: {{ .Values.storageClasses.shared.provisioner }}
reclaimPolicy: {{ .Values.storageClasses.shared.reclaimPolicy }}
{{ if .Values.storageClasses.shared.parameters -}}
parameters:
{{- range $key, $value := .Values.storageClasses.shared.parameters }}
  {{ $key }}: {{ $value }}
{{- end }}
{{ if .Values.storageClasses.shared.mountOptions -}}
mountOptions:
{{- range .Values.storageClasses.shared.mountOptions }}
  - {{ . }}
{{- end }}
{{- end }}
allowVolumeExpansion: {{ .Values.storageClasses.shared.allowVolumeExpansion }}
{{- end }}
{{- end }}
