apiVersion: v1
kind: ConfigMap
metadata:
  name: redis-config
  namespace: kong
data:
  nutcracker.conf: |
    write:
      listen: /tmp/sockets/redis-write.sock
      redis: true
      redis_auth: ${redis-password}
      auto_eject_hosts: true
      timeout: 2000
      server_retry_timeout: 5000
      server_failure_limit: 1
      server_connections: 20
      preconnect: true
      servers:
        - /tmp/sockets/stunnel-write.sock:1
    read:
      listen: /tmp/sockets/redis-read.sock
      redis: true
      redis_auth: ${redis-password}
      auto_eject_hosts: true
      timeout: 2000
      server_retry_timeout: 5000
      server_failure_limit: 1
      server_connections: 20
      preconnect: true
      servers:
        - /tmp/sockets/stunnel-write.sock:1
        - /tmp/sockets/stunnel-read.sock:1
  stunnel.conf: |
    foreground = yes
    [redis-master]
    client = yes
    connect = redis-master:6379
    accept = /tmp/sockets/stunnel-write.sock
    [redis-slave]
    client = yes
    connect = redis-slave:6379
    accept = /tmp/sockets/stunnel-read.sock
