kind: ConfigMap
metadata:
  name: zookeeper-config
  namespace: imxc
apiVersion: v1
data:
  init.sh: |-
    #!/bin/bash
    set -e
    set -x
    [ -d /var/lib/zookeeper/data ] || mkdir /var/lib/zookeeper/data
    [ -z "$ID_OFFSET" ] && ID_OFFSET=1
    export ZOOKEEPER_SERVER_ID=$((${HOSTNAME##*-} + $ID_OFFSET))
    echo "${ZOOKEEPER_SERVER_ID:-1}" | tee /var/lib/zookeeper/data/myid
    cp -Lur /etc/kafka-configmap/* /etc/kafka/
    sed -i "s/server\.$ZOOKEEPER_SERVER_ID\=[a-z0-9.-]*/server.$ZOOKEEPER_SERVER_ID=0.0.0.0/" /etc/kafka/zookeeper.properties
  zookeeper.properties: |-
    tickTime=2000
    dataDir=/var/lib/zookeeper/data
    dataLogDir=/var/lib/zookeeper/log
    clientPort=2181
    maxClientCnxns=1
    initLimit=5
    syncLimit=2
    server.1=zookeeper-0.zookeeper-headless.imxc.svc.cluster.local:2888:3888:participant
    server.2=zookeeper-1.zookeeper-headless.imxc.svc.cluster.local:2888:3888:participant
    server.3=zookeeper-2.zookeeper-headless.imxc.svc.cluster.local:2888:3888:participant
  log4j.properties: |-
    log4j.rootLogger=INFO, stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
    # Suppress connection log messages, three lines per livenessProbe execution
    log4j.logger.org.apache.zookeeper.server.NIOServerCnxnFactory=WARN
    log4j.logger.org.apache.zookeeper.server.NIOServerCnxn=WARN
