---
# Source: zeebe-cluster/templates/configmap.yaml
kind: ConfigMap
metadata:
  name: "zell-no-rep-tmpfs-entry256kb-128mb-zeebe"
  labels: 
    app.kubernetes.io/name: zeebe-cluster
    app.kubernetes.io/instance: zell-no-rep-tmpfs-entry256kb-128mb
    app: "zell-no-rep-tmpfs-entry256kb-128mb-zeebe"
apiVersion: v1
data:
  startup.sh: |
    #!/usr/bin/env bash
    set -eux -o pipefail

    export ZEEBE_ADVERTISED_HOST=${ZEEBE_ADVERTISED_HOST:-$(hostname -f)}
    export ZEEBE_NODE_ID=${ZEEBE_NODE_ID:-${K8S_POD_NAME##*-}}

    # As the number of replicas or the DNS is not obtainable from the downward API yet,
    # defined them here based on conventions
    export ZEEBE_CLUSTER_SIZE=${ZEEBE_CLUSTER_SIZE:-1}
    contactPointPrefix=${K8S_POD_NAME%-*}
    contactPoints=${ZEEBE_CONTACT_POINTS:-""}
    if [[ -z "${contactPoints}" ]]; then
      for ((i=0; i<${ZEEBE_CLUSTER_SIZE}; i++))
      do
        contactPoints="${contactPoints},${contactPointPrefix}-$i.$(hostname -d):26502"
      done

      export ZEEBE_CONTACT_POINTS="${contactPoints}"
    fi

    exec /usr/local/zeebe/bin/broker
  zeebe.cfg.toml: |
    # custom TOML configuration

    # For more information about this configuration visit: https://docs.zeebe.io/operations/the-zeebecfgtoml-file.html
    [threads]
    cpuThreadCount = "4"
    ioThreadCount = "4"
    [gateway]
    enable = false
    [gateway.monitoring]
    enabled = true
    [[exporters]]
    id = "elasticsearch"
    className = "io.zeebe.exporter.ElasticsearchExporter"
      [exporters.args]
      url = "http://elasticsearch-master:9200"

      [exporters.args.bulk]
      delay = 5
      size = 1_000

      #[exporters.args.authentication]
      #username = elastic
      #password = changeme

      [exporters.args.index]
      prefix = "zeebe-record"
      createTemplate = true

      command = false
      event = true
      rejection = false

      deployment = true
      incident = true
      job = true
      message = false
      messageSubscription = false
      raft = false
      workflowInstance = true
      workflowInstanceSubscription = false
