apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  {{- if .Values.persistentVolume.annotations }}
  annotations:
{{ toYaml .Values.persistentVolume.annotations | indent 4 }}
  {{- end }}
  labels:
    {{- include "anythingllm.labels" . | nindent 4 }}
    {{- with .Values.persistentVolume.labels }}
       {{- toYaml . | nindent 4 }}
    {{- end }}
  name: {{ include "anythingllm.fullname" . }}-storage-claim
spec:
  accessModes:
    {{- toYaml .Values.persistentVolume.accessModes | nindent 4 }}
{{- if .Values.persistentVolume.storageClass }}
{{- if (eq "-" .Values.persistentVolume.storageClass) }}
  storageClassName: ""
{{- else }}
  storageClassName: "{{ .Values.persistentVolume.storageClass }}"
{{- end }}
{{- end }}
  resources:
    requests:
      storage: {{ .Values.persistentVolume.size }}
{{- if .Values.persistentVolume.volumeName }}
  volumeName: "{{ .Values.persistentVolume.volumeName }}"
{{- end -}}
  {{- with .Values.persistentVolume.selector }}
  selector:
    {{- toYaml . | nindent 4 }}
  {{- end }}