{{- if and .Values.gerrit.pluginManagement.cache.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ .Release.Name }}-plugin-cache-pvc
  labels:
    app.kubernetes.io/component: gerrit
    app.kubernetes.io/instance: {{ .Release.Name }}
    chart: {{ template "gerrit.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    {{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels  | indent 4 }}
    {{- end }}
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: {{ .Values.gerrit.pluginManagement.cache.size }}
  storageClassName: {{ .Values.storageClasses.shared.name }}
{{- end }}
{{ if eq .Values.gerrit.index.type "elasticsearch" -}}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ .Release.Name }}-gerrit-index-config-pvc
  labels:
    app.kubernetes.io/component: gerrit
    app.kubernetes.io/instance: {{ .Release.Name }}
    chart: {{ template "gerrit.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    {{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels  | indent 4 }}
    {{- end }}
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 10Mi
  storageClassName: {{ .Values.storageClasses.shared.name }}
{{- end }}
