{{- if not .Values.cluster.enabled }}
{{- $pvc := .Values.standalone.persistence.persistentVolumeClaim -}}
{{- if and .Values.standalone.persistence.enabled (not $pvc.existingClaim) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ printf "%s" (include "milvus.fullname" . | trunc 58)}}
{{- with .Values.standalone.persistence.annotations  }}
  annotations:
{{ toYaml . | indent 4 }}
{{- end }}
  labels:
{{ include "milvus.labels" . | indent 4 }}
spec:
  accessModes:
  - {{ $pvc.accessModes | quote }}
  {{- if $pvc.storageClass }}
    {{- if eq "-" $pvc.storageClass }}
  storageClassName: ""
    {{- else }}
  storageClassName: {{ $pvc.storageClass }}
    {{- end }}
  {{- end }}
  resources:
    requests:
      storage: {{ $pvc.size }}
{{- end }}
{{- end }}

{{- $pvc := .Values.log.persistence.persistentVolumeClaim -}}
{{- if and .Values.log.persistence.enabled (not $pvc.existingClaim)}}

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ printf "%s-logs" (include "milvus.fullname" . | trunc 58)}}
{{- with .Values.log.persistence.annotations  }}
  annotations:
{{ toYaml . | indent 4 }}
{{- end }}
  labels:
{{ include "milvus.labels" . | indent 4 }}
spec:
  accessModes:
  - {{ $pvc.accessModes | quote }}
  {{- if $pvc.storageClass }}
    {{- if eq "-" $pvc.storageClass }}
  storageClassName: ""
    {{- else }}
  storageClassName: {{ $pvc.storageClass }}
    {{- end }}
  {{- end }}
  resources:
    requests:
      storage: {{ $pvc.size }}
{{- end }}
