---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app.kubernetes.io/name: redis
    app.kubernetes.io/part-of: nextcloud
    app.kubernetes.io/component: database
  name: redis
  namespace: nextcloud
spec:
  serviceName: redis
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: redis
      app.kubernetes.io/part-of: nextcloud
      app.kubernetes.io/component: database
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-container: redis
      labels:
        app.kubernetes.io/name: redis
        app.kubernetes.io/part-of: nextcloud
        app.kubernetes.io/component: database
    spec:
      containers:
      - args:
        - "--requirepass"
        - "$(REDIS_HOST_PASSWORD)"
        envFrom:
        - secretRef:
            name: redis-password
        image: redis:5-alpine
        imagePullPolicy: Always
        name: redis
        ports:
        - containerPort: 6379
          name: redis
        resources:
          requests:
            cpu: 3m
            memory: 5Mi
      - args:
        - "--redis.password"
        - "$(REDIS_HOST_PASSWORD)"
        - "--redis.addr"
        - "127.0.0.1"
        envFrom:
        - secretRef:
            name: redis-password
        image: oliver006/redis_exporter
        name: redis-exporter
        ports:
        - containerPort: 9121
          name: metrics
        resources:
          requests:
            cpu: 1m
            memory: 13Mi
          limits:
            memory: 20Mi
      #securityContext:
      #  sysctls:
      #  - name: "net.core.somaxconn"
      #    value: "512"
      restartPolicy: Always
      nodeSelector:
        kubernetes.io/arch: "amd64"
      tolerations: []
