kind: Service
apiVersion: v1
metadata:
  labels:
    app: redis-master
  name: redis-master
  namespace: edoc2
spec:
  #clusterIP: None
  ports:
  - name: redis
    port: 6379
    targetPort: 6379
    nodePort: 36399
  selector:
    app: redis-master
  #type: ClusterIP
  type: NodePort
---
#kind: StatefulSet
kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    app: redis-master
  name: redis-master
  namespace: edoc2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis-master
  #serviceName: redis
  template:
    metadata:
      labels:
        app: redis-master
    spec:
      hostname: redis-master
      initContainers:
      - name: increase-somaxconn-map
        image: registry.edoc2.com:5000/library/busybox:1.28
        command: ["sysctl", "-w", "net.core.somaxconn=8096"]
        securityContext:
          privileged: true
      containers:
      - args:
        - -c
        - cp /mnt/redis-master.conf /data/ ; redis-server /data/redis-master.conf
        command:
        - sh
        image: registry.edoc2.com:5000/edoc2v5/redis:prod600-v4.0.14.8
        imagePullPolicy: IfNotPresent
        name: redis-master
        ports:
        - containerPort: 6379
          name: masterport
          protocol: TCP
        volumeMounts:
        - mountPath: /mnt/
          name: config-volume
          readOnly: false
        - mountPath: /data/
          name: redis-storage-data
          readOnly: false
      serviceAccountName: redis-sentinel
      terminationGracePeriodSeconds: 15
      restartPolicy: Always
      volumes:
      - configMap:
          items:
          - key: redis-master.conf
            path: redis-master.conf
          name: redis-sentinel-config
        name: config-volume
      - name: redis-storage-data
        hostPath:
          path: /data/redis/
      #- name: redis-storage-data
      #  persistentVolumeClaim:
      #    claimName: local-redis-storage
      nodeSelector:
        #"node.labels.nodelabels": Middleware
        "node.redis2.labels": redis-node02
  #volumeClaimTemplates:
  #- metadata:
  #    name: redis-storage-data
  #  spec:
  #    accessModes: [ "ReadWriteOnce" ]
  #    storageClassName: "local-redis-storage"
  #    resources:
  #      requests:
  #        storage: 50Gi
    #selector:
    #  name: redis-master
