apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
  name: {{ .Release.Name }}
  labels:
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  sentinel:
    replicas: 3
    resources:
      requests:
        cpu: 100m
      limits:
        memory: 100Mi
  redis:
    replicas: {{ .Values.replicas }}
    resources:
      requests:
        cpu: 150m
        memory: 400Mi
      limits:
        cpu: 2
        memory: 1000Mi
    {{- with .Values.size }}
    storage:
      persistentVolumeClaim:
        metadata:
          name: redisfailover-persistent-data
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: {{ . }}
    {{- end }}
    exporter: 
      enabled: true
      image: oliver006/redis_exporter:v1.55.0-alpine
      args:
        - --web.telemetry-path
        - /metrics
      env:
        - name: REDIS_EXPORTER_LOG_FORMAT
          value: txt
    customConfig:
      - tcp-keepalive 0
      - loglevel notice
      {{- if not .Values.size }}
      - appendonly no
      - save ""
      {{- end }}
