---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
spec:
  replicas: 1
  selector:
    matchLabels:
      name: redis
  template:
    metadata:
      labels:
        name: redis
        service: redis
    spec:
      containers:
        - name: redis
          image: quay.io/ukhomeofficedigital/redis:v0.1.2
          ports:
            - containerPort: 6379
          env:
            - name: REDIS_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: redis
                  key: pass
          command: ['/usr/bin/bash']
          args: ['-c', 'echo "requirepass ${REDIS_PASSWORD}" >> /etc/redis.conf && /run.sh']
          volumeMounts:
            - mountPath: /var/lib/redis
              name: data
          securityContext:
            runAsNonRoot: true
      volumes:
        - name: data
          emptyDir: {}
