apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: auth-cache-stateful
  namespace: repoflow-blog-namespace
  labels:
    moduleid: microservice-auth-realm
    version: 1.70.10-master
spec:
  serviceName: auth-cache-service
  selector:
    matchLabels:
      app: auth-cache-stateful
  replicas: 1
  template:
    metadata:
      labels:
        moduleid: microservice-auth-cache
        version: 1.70.3-master
        app: auth-cache-stateful
    spec:
      terminationGracePeriodSeconds: 10
      containers:
        -
          name: data
          image: 'redis:3.2-alpine'
          args:
            - '--requirepass'
            - $(CACHE_SECRET_PASSWORD)
            - '--appendonly'
            - 'yes'
            - '--save'
            - '900'
            - '1'
            - '--save'
            - '30'
            - '1'
          env:
            -
              name: CACHE_SECRET_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: auth-cache-secret
                  key: password
          ports:
            -
              containerPort: 6379
          volumeMounts:
            -
              name: data
              mountPath: /data
      volumes:
        -
          name: data
          persistentVolumeClaim:
            claimName: auth-cache-volume-claim
