apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-cluster
  namespace: faasm
  labels:
    role: redis
spec:
  serviceName: redis-cluster
  replicas: 3
  selector:
    matchLabels:
      app: redis-cluster
  template:
    metadata:
      labels:
        app: redis-cluster
    spec:
      containers:
        - name: redis
          image: faasm/redis-cluster
          ports:
            - containerPort: 6379
              name: client
            - containerPort: 16379
              name: gossip
          readinessProbe:
            exec:
              command:
                - sh
                - -c
                - "redis-cli -h $(hostname) ping"
            initialDelaySeconds: 15
            timeoutSeconds: 5
          livenessProbe:
            exec:
              command:
                - sh
                - -c
                - "redis-cli -h $(hostname) ping"
            initialDelaySeconds: 20
            periodSeconds: 3
          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
