{{- if eq .Values.global.logger_redis_location "on-cluster" }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: drycc-logger-redis
  labels:
    heritage: drycc
  annotations:
    component.drycc.cc/version: {{ .Values.docker_tag }}
spec:
  serviceName: drycc-logger-redis
  replicas: {{ .Values.replicas }}
  selector:
    matchLabels:
      app: drycc-logger-redis
  template:
    metadata:
      labels:
        app: drycc-logger-redis
    spec:
      containers:
      - name: drycc-logger-redis
        image: {{.Values.docker_registry}}{{ .Values.org }}/redis:{{ .Values.docker_tag }}
        imagePullPolicy: {{ .Values.pull_policy }}
{{- if or (.Values.limits_cpu) (.Values.limits_memory)}}
        resources:
          limits:
{{- if (.Values.limits_cpu) }}
            cpu: {{.Values.limits_cpu}}
{{- end}}
{{- if (.Values.limits_memory) }}
            memory: {{.Values.limits_memory}}
{{- end}}
{{- end}}
        command: ["/bin/boot", "--port", "{{.Values.port}}"]
        ports:
        - containerPort: {{.Values.port}}
        volumeMounts:
        - name: logger-redis-creds
          mountPath: /var/run/secrets/drycc/redis/creds
      volumes:
      - name: logger-redis-creds
        secret:
          secretName: logger-redis-creds
{{- end }}
