apiVersion: v1
kind: ConfigMap
metadata:
  name: rabbitmq-config
  namespace: rabbitmq-test
data:
  enabled_plugins: |
    [rabbitmq_peer_discovery_k8s, rabbitmq_management, rabbitmq_prometheus].

  rabbitmq.conf: |
      cluster_formation.peer_discovery_backend  = rabbit_peer_discovery_k8s
      cluster_formation.k8s.host = kubernetes.default.svc.cluster.local
      cluster_formation.k8s.address_type = hostname
      cluster_formation.node_cleanup.interval = 30
      cluster_formation.node_cleanup.only_log_warning = true
      cluster_partition_handling = autoheal
      queue_master_locator=min-masters

      # AMQP
      #listeners.tcp = none  # default port 5672 used by RS server without ssl, can restict acess through ip interface/firewall  
      listeners.ssl.default = 5671
      ssl_options.cacertfile = /certs/ca-cert.pem
      ssl_options.certfile = /certs/server-cert.pem
      ssl_options.keyfile = /certs/server-key.pem
      ssl_options.verify = verify_none
      ssl_options.fail_if_no_peer_cert = false

      # Management API
      management.tcp.port = 15672 # used by RS server without ssl
      management.ssl.port = 15671
      management.ssl.cacertfile = /certs/ca-cert.pem
      management.ssl.certfile   = /certs/server-cert.pem
      management.ssl.keyfile    = /certs/server-key.pem
      
      # Provisioning
      load_definitions = /secrets/rabbitmq-definitions.json

      # Logging
      log.console = true
      log.console.level = info
      log.file = false

      # Monitoring
      collect_statistics_interval = 10000
      prometheus.tcp.port = 15692
      prometheus.tcp.ip = 0.0.0.0
      
      # Memory, disks
      disk_free_limit.relative = 1.0
      vm_memory_high_watermark.relative = 0.4
      vm_memory_high_watermark_paging_ratio = 0.6

