How to pass extra configuration to RabbitMQ with Helm?
According to https://github.com/helm/charts/tree/master/stable/rabbitmq#load-definitions, it is possible to link a JSON
configuration as extraConfiguration
. So we ended up with this setup that works:
rabbitmq-values.yaml:
rabbitmq: loadDefinition: enabled: true secretName: rabbitmq-load-definition extraConfiguration: management.load_definitions = /app/load_definition.json
rabbitmq-secret.yaml:
apiVersion: v1kind: Secretmetadata: name: rabbitmq-load-definitiontype: OpaquestringData: load_definition.json: |- { "vhosts": [ { "name": "/" } ], "policies": [ { "name": "queue-mirroring-exactly-two", "pattern": "^ha\.", "vhost": "/", "definition": { "ha-mode": "exactly", "ha-params": 2 } } ] }
The secret must be loaded into Kubernetes before the Helm chart is played, which goes something like this: kubectl apply -f ./rabbitmq-secret.yaml
.
You can use config default of HelmChart
If needed, you can use extraSecrets to let the chart create the secret for you. This way, you don't need to manually create it before deploying a release. For example :
extraSecrets: load-definition: load_definition.json: | { "vhosts": [ { "name": "/" } ] }rabbitmq: loadDefinition: enabled: true secretName: load-definition extraConfiguration: | management.load_definitions = /app/load_definition.json
Instead of using extraConfiguration, use advancedConfiguration, you should put all these info in this section as it is for classic config format (erlang)