{{- if .Values.persistence.enabled -}}
{{- if not .Values.persistence.existingClaim -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ template "superset.fullname" . }}
  labels:
    app: {{ template "superset.name" . }}
    chart: {{ template "superset.chart" . }}
    release: {{ .Release.Name }}
spec:
  accessModes:
{{ toYaml .Values.persistence.accessModes | indent 4 }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
  storageClassName: ""
{{- else }}
  storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
  resources:
    requests:
      storage: "{{ .Values.persistence.size }}"
{{- end -}}
{{- end -}}