apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
spec:
  selector:
    matchLabels:
      service: redis
  replicas: 1
  template:
    metadata:
      labels:
        service: redis
    spec:
      containers:
        - name: main
          image: sloopstash/redis:v1
          imagePullPolicy: Always
          volumeMounts:
            - name: supervisor-server
              mountPath: /etc/supervisord.conf
            - name: redis-supervisor
              mountPath: /etc/supervisord.d/redis.ini
            - name: redis-server
              mountPath: /opt/redis/conf/redis.conf
            - name: redis-data
              mountPath: /opt/redis/data
            - name: redis-log
              mountPath: /opt/redis/log
          command:
            - "/usr/bin/supervisord"
            - "-c"
            - "/etc/supervisord.conf"
          ports:
            - containerPort: 6379
        - name: log
          image: sloopstash/redis:v1
          volumeMounts:
            - name: supervisor-server
              mountPath: /etc/supervisord.conf
            - name: redis-log
              mountPath: /opt/redis/log
          command:
            - "/usr/bin/supervisord"
            - "-c"
            - "/etc/supervisord.conf"
      volumes:
        - name: supervisor-server
          hostPath:
            path: /opt/kickstart-kubernetes/supervisor/conf/main.conf
            type: File
        - name: redis-supervisor
          hostPath:
            path: /opt/kickstart-kubernetes/supervisor/conf/redis.ini
            type: File
        - name: redis-server
          hostPath:
            path: /opt/kickstart-kubernetes/redis/conf/main.conf
            type: File
        - name: redis-data
          persistentVolumeClaim:
            claimName: redis-data
        - name: redis-log
          persistentVolumeClaim:
            claimName: redis-log
