{{- if eq .Values.global.redis_location "on-cluster" }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: drycc-redis
  labels:
    heritage: drycc
  annotations:
    component.drycc.cc/version: {{ .Values.image_tag }}
spec:
  serviceName: drycc-redis
  replicas: {{ .Values.replicas }}
  selector:
    matchLabels:
      app: drycc-redis
  template:
    metadata:
      labels:
        app: drycc-redis
    spec:
      containers:
      - name: drycc-redis
        image: {{.Values.image_registry}}{{ .Values.org }}/redis:{{ .Values.image_tag }}
        imagePullPolicy: {{ .Values.image_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", "6379"]
        ports:
        - containerPort: 6379
        volumeMounts:
        - name: redis-creds
          mountPath: /var/run/secrets/drycc/redis/creds
      volumes:
      - name: redis-creds
        secret:
          secretName: redis-creds
{{- end }}
