Adjust RabbitMQ 4 to join existing cluster

With RabbitMQ 4 the peer discovery[1] was changed, so all replicas join pod-0 and pod-0 creates the cluster. This comes to issues if pod-0 lost it's data (or the PVC got deleted, e.g. due to node redeploy), so pod-0 build it's own cluster.

This is more or less expected[2] but not, what we want at yaook. So adjust the script, that we check for an existing cluster and join it.

The approach using DNS entries is copied from the Database startup.

Also adjust some commands and the startupProbe to fit the commands of RabbitMQ 4.

[1] https://www.rabbitmq.com/blog/2025/04/04/new-k8s-peer-discovery#kubernetes-peer-discovery-in-rabbitmq-41

[2] https://github.com/rabbitmq/cluster-operator/issues/1957#issuecomment-3304012484

Supported-by: @tschuettig

Fixes: #650 (closed)

Edited by Stefan Hoffmann

Merge request reports

Loading