kind: Service
apiVersion: v1
metadata:
  labels:
    app: redis-sentinel0
  name: redis-sentinel0
  namespace: edoc2
spec:
  ports:
  - name: nredis
    port: 26379
    targetPort: 26379
    nodePort: 33389
  selector:
    app: redis-sentinel0
  #type: ClusterIP
  type: NodePort
---
#kind: StatefulSet
kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    app: redis-sentinel0
  name: redis-sentinel0
  namespace: edoc2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis-sentinel0
  #serviceName: redis-sentinel
  template:
    metadata:
      labels:
        app: redis-sentinel0
    spec:
      hostname: redis-sentinel0
      initContainers:
      - name: nincrease-somaxconn-map
        image: registry.edoc2.com:5000/library/busybox-arm:latest
        command: ["sysctl", "-w", "net.core.somaxconn=8096"]
        securityContext:
          privileged: true
      containers:
      - name: redis-sentinel0
        image: registry.edoc2.com:5000/edoc2v5/redis:6.2.12-arm64
        imagePullPolicy: IfNotPresent
        command:
        - bash
        - "-c"
        - |
          set -ex
          mkdir -p /conf/
          cp /mnt/sentinel.conf /conf/redis-sentinel.conf
          redis-sentinel /conf/redis-sentinel.conf
        ports:
        - containerPort: 26379
          name: nsentinel-port
          protocol: TCP
        volumeMounts:
        - mountPath: /mnt/
          name: config-map
          readOnly: false
      #serviceAccountName: redis-sentinel
      terminationGracePeriodSeconds: 15
      volumes:
      volumes:
      - name: config-map
        configMap:
          name: redis
      nodeSelector:
        ##"node.plabels.nodelabels": pMiddleware
        "node.redis1.labels": redis-node01
---
kind: Service
apiVersion: v1
metadata:
  labels:
    app: redis-sentinel1
  name: redis-sentinel1
  namespace: edoc2
spec:
  ports:
  - name: nredis
    port: 26379
    targetPort: 26379
  selector:
    app: redis-sentinel1
  type: ClusterIP
---
#kind: StatefulSet
kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    app: redis-sentinel1
  name: redis-sentinel1
  namespace: edoc2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis-sentinel1
  #serviceName: redis-sentinel
  template:
    metadata:
      labels:
        app: redis-sentinel1
    spec:
      hostname: redis-sentinel1
      initContainers:
      - name: nincrease-somaxconn-map
        image: registry.edoc2.com:5000/library/busybox-arm:latest
        command: ["sysctl", "-w", "net.core.somaxconn=8096"]
        securityContext:
          privileged: true
      containers:
      - name: redis-sentinel0
        image: registry.edoc2.com:5000/edoc2v5/redis:6.2.12-arm64
        imagePullPolicy: IfNotPresent
        command:
        - bash
        - "-c"
        - |
          set -ex
          mkdir -p /conf/
          cp /mnt/sentinel.conf /conf/redis-sentinel.conf
          redis-sentinel /conf/redis-sentinel.conf
        ports:
        - containerPort: 26379
          name: nsentinel-port
          protocol: TCP
        volumeMounts:
        - mountPath: /mnt/
          name: config-map
          readOnly: false
      #serviceAccountName: redis-sentinel
      terminationGracePeriodSeconds: 15
      volumes:
      volumes:
      - name: config-map
        configMap:
          name: redis
      nodeSelector:
        #"node.plabels.nodelabels": pMiddleware
        "node.redis2.labels": redis-node02
---
kind: Service
apiVersion: v1
metadata:
  labels:
    app: redis-sentinel2
  name: redis-sentinel2
  namespace: edoc2
spec:
  ports:
  - name: nredis
    port: 26379
    targetPort: 26379
  selector:
    app: redis-sentinel2
  type: ClusterIP
---
#kind: StatefulSet
kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    app: redis-sentinel2
  name: redis-sentinel2
  namespace: edoc2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis-sentinel2
  #serviceName: redis-sentinel
  template:
    metadata:
      labels:
        app: redis-sentinel2
    spec:
      hostname: redis-sentinel2
      initContainers:
      - name: nincrease-somaxconn-map
        image: registry.edoc2.com:5000/library/busybox-arm:latest
        command: ["sysctl", "-w", "net.core.somaxconn=8096"]
        securityContext:
          privileged: true
      containers:
      - name: redis-sentinel0
        image: registry.edoc2.com:5000/edoc2v5/redis:6.2.12-arm64
        imagePullPolicy: IfNotPresent
        command:
        - bash
        - "-c"
        - |
          set -ex
          mkdir -p /conf/
          cp /mnt/sentinel.conf /conf/redis-sentinel.conf
          redis-sentinel /conf/redis-sentinel.conf
        ports:
        - containerPort: 26379
          name: nsentinel-port
          protocol: TCP
        volumeMounts:
        - mountPath: /mnt/
          name: config-map
          readOnly: false
      #serviceAccountName: redis-sentinel
      terminationGracePeriodSeconds: 15
      volumes:
      volumes:
      - name: config-map
        configMap:
          name: redis
      nodeSelector:
        #"node.plabels.nodelabels": pMiddleware
        "node.redis3.labels": redis-node03
