apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: session-dev
  name: redis-cache-001
  labels:
    app: redis-cache-001
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  selector:
    matchLabels:
      app: redis-cache-001
  template:
    metadata:
      labels:
        app: redis-cache-001
        component: redis
    spec:
      containers:
      - name: redis-cache-001
        image: redis:latest
        imagePullPolicy: IfNotPresent
        ports:
          - containerPort: 6379
        command: 
          - redis-server
          - "/redis-master/redis.conf"
        env:
          - name: REDIS_PASSWORD
            value: Password12#$
        resources:
          limits:
            cpu: 500m
            memory: 512Mi
          requests:
            cpu: 300m
            memory: 256Mi
        volumeMounts:
        #- name: persistent-storage
        #  mountPath: /data
        - name: shared-storage
          mountPath: /data
        - name: config
          mountPath: /redis-master
      #- name: predixy
      #  image: htdp1/predixy:v2
      #  imagePullPolicy: IfNotPresent
      #  ports:
      #    - containerPort: 6380
      #      name: predixy
      #  command: 
      #    - /usr/local/bin/predixy
      #    - "/etc/predixy/conf/predixy.conf"
      #  resources:
      #    limits:
      #      cpu: 500m
      #      memory: 512Mi
      #    requests:
      #      cpu: 200m
      #      memory: 256Mi
      #  volumeMounts:
      #  - name: predixy-config
      #    mountPath: /etc/predixy/conf
      #  - name: shared-storage
      #    mountPath: /data
      volumes:
      - name: shared-storage
        persistentVolumeClaim:
          claimName: redis-nfs
      - name: config
        configMap:
          name: redis-cache-001
          items:
          - key: redis.conf
            path: redis.conf
