apiVersion: apps/v1
kind: Deployment
metadata:
  name: sentry-redis-slave
  labels:
    app: redis
spec:
  selector:
    matchLabels:
      role: slave
      app: redis
  replicas: 1
  template:
    metadata:
      labels:
        role: slave
        app: redis
        component: sentry
    spec:
      securityContext:
        fsGroup: 1001
        runAsUser: 1001
      serviceAccountName: "default"
      containers:
      - name: sentry-redis
        image: docker.io/bitnami/redis:4.0.11-debian-9
        imagePullPolicy: "Always"
        env:
        - name: REDIS_REPLICATION_MODE
          value: slave
        - name: REDIS_MASTER_HOST
          value: sentry-redis-master
        - name: REDIS_PORT
          value: "6379"
        - name: REDIS_MASTER_PORT_NUMBER
          value: "6379"
        - name: REDIS_PASSWORD
          valueFrom:
            secretKeyRef:
              name: sentry-redis
              key: redis-password
        - name: REDIS_MASTER_PASSWORD
          valueFrom:
            secretKeyRef:
              name: sentry-redis
              key: redis-password
        - name: REDIS_DISABLE_COMMANDS
          value: FLUSHDB,FLUSHALL
        ports:
        - name: redis
          containerPort: 6379
        livenessProbe:
          initialDelaySeconds: 30
          periodSeconds: 10
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
          exec:
            command:
            - redis-cli
            - ping
        readinessProbe:
          initialDelaySeconds: 5
          periodSeconds: 10
          timeoutSeconds: 1
          successThreshold: 1
          failureThreshold: 5
          exec:
            command:
            - redis-cli
            - ping
