{{- if .Values.redis.enabled -}}
apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: Redis
metadata:
  name: {{ include "Sorcerer.fullname" . }}-redis
  namespace: {{ .Release.Namespace }}
  annotations:
    linkerd.io/inject: disabled
  labels:
    {{- include "Sorcerer.labels" . | nindent 4 }}
spec:
  kubernetesConfig:
    image: quay.io/opstree/redis:v7.2.6
    imagePullPolicy: IfNotPresent
    resources:
      requests:
        cpu: 101m
        memory: 128Mi
      limits:
        memory: 256Mi
    redisSecret:
      name: {{ .Values.redis.secret.name | quote }}
      key: {{ .Values.redis.secret.key | quote }}
  serviceMonitor:
    enabled: {{ .Values.redis.metrics.enabled | default false }}
  redisExporter:
    enabled: {{ .Values.redis.exporterEnabled | default false }}
    image: quay.io/opstree/redis-exporter:v1.44.0
    imagePullPolicy: Always
    resources:
      requests:
        cpu: 100m
        memory: 128Mi
      limits:
        memory: 256Mi
  storage:
    volumeClaimTemplate:
      spec:
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: {{ .Values.cluster.size | default "1Gi" }}
  podSecurityContext:
    runAsUser: 1000
    fsGroup: 1000
{{- end}}
