{{- if and (not .Values.haMode.enabled) (.Values.useDeploymentWhenNonHA) }}
{{- $createPvc := and (empty .Values.storage.persistentVolumeClaimName) (.Values.storage.requestedSize) }}
{{- if $createPvc }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ include "redis.fullname" . }}
  labels:
    {{- include "redis.labels" . | nindent 4 }}
  {{- if .Values.storage.keepPvc }}
  annotations:
    "helm.sh/resource-policy": keep
  {{- end }}
spec:
  {{- with .Values.storage }}
  accessModes:
    {{- toYaml .accessModes | nindent 4 }}
  volumeMode: Filesystem
  resources:
    requests:
      storage: {{ .requestedSize }}
  {{- if .className }}
  storageClassName: {{ .className }}
  {{- end }}
  {{- end }}  
{{- end }}
{{- end }}
