[stable/rabbitmq-ha] Add custom definitions (#7571)

* [stable/rabbitmq-ha] Add custom definitions

Since v1.9.0, a definitions.json file have been created, needed for users
creation for health check, prometheus, etc.
It is thus impossible to get these features using a custom definitions.json
This commit allows you to add :
 - Users
 - Vhosts
 - Permissions
 - Policies (already present, just moved)
 - Queues
 - Exchanges
 - Bindings

Signed-off-by: Clement Decoodt <clement@decoodt.eu>

* [stable/rabbitmq-ha]: Add parameters in definitions

Fix default values in readme.
Simplify the definitions.json template, and let all the items being
rendered (with empty arrays if empty)

Signed-off-by: Clement Decoodt <clement@decoodt.eu>
This commit is contained in:
Lichard Torman
2018-10-16 00:43:19 -07:00
committed by k8s-ci-robot
parent e1c5d06b0d
commit 83e5cd0310
4 changed files with 103 additions and 17 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
name: rabbitmq-ha
apiVersion: v1
appVersion: 3.7.4
version: 1.11.1
version: 1.12.0
description: Highly available RabbitMQ cluster, the open source message broker
software that implements the Advanced Message Queuing Protocol (AMQP).
keywords:
+9 -2
View File
@@ -67,7 +67,15 @@ and their default values.
|------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| `existingConfigMap` | Use an existing ConfigMap | `false` |
| `existingSecret` | Use an existing secret for password & erlang cookie | `""`                               |
| `extraConfig` | Additional configuration to add to default configmap | `` |
| `extraConfig` | Additional configuration to add to default configmap | `{}` |
| `definitions.users` | Additional users | `""` |
| `definitions.vhosts` | Additional vhosts | `""` |
| `definitions.parameters` | Additional parameters | `""` |
| `definitions.permissions` | Additional permissions | `""` |
| `definitions.queues` | Pre-created queues | `""` |
| `definitions.exchanges` | Pre-created exchanges | `""` |
| `definitions.bindings` | Pre-created bindings | `""` |
| `definitions.policies` | HA policies to add to definitions.json | `""` |
| `image.pullPolicy` | Image pull policy | `Always` if `image` tag is `latest`, else `IfNotPresent` |
| `image.repository` | RabbitMQ container image repository | `rabbitmq` |
| `image.tag` | RabbitMQ container image tag | `3.7-alpine` |
@@ -82,7 +90,6 @@ and their default values.
| `persistentVolume.size` | Persistent volume size | `8Gi` |
| `persistentVolume.storageClass` | Persistent volume storage class | `-` |
| `podAntiAffinity` | Pod antiaffinity, `hard` or `soft` | `hard` |
| `policies` | HA policies to add to definitions.json | `` |
| `prometheus.exporter.enabled` | Configures Prometheus Exporter to expose and scrape stats | `false` |
| `prometheus.exporter.env` | Environment variables to set for Exporter container | `{}` |
| `prometheus.exporter.image.repository` | Prometheus Exporter repository | `kbudde/rabbitmq-exporter` |
+22 -4
View File
@@ -65,12 +65,16 @@ users, virtual hosts, permissions and parameters) to load by the management plug
"name": {{ .Values.rabbitmqUsername | quote }},
"password": {{ .Values.rabbitmqPassword | quote }},
"tags": "administrator"
}
}{{- if .Values.definitions.users -}},
{{ .Values.definitions.users | indent 4 }}
{{- end }}
],
"vhosts": [
{
"name": {{ .Values.rabbitmqVhost | quote }}
}
}{{- if .Values.definitions.vhosts -}},
{{ .Values.definitions.vhosts | indent 4 }}
{{- end }}
],
"permissions": [
{
@@ -79,10 +83,24 @@ users, virtual hosts, permissions and parameters) to load by the management plug
"configure": ".*",
"read": ".*",
"write": ".*"
}
}{{- if .Values.definitions.permissions -}},
{{ .Values.definitions.permissions | indent 4 }}
{{- end }}
],
"parameters": [
{{ .Values.definitions.parameters| indent 4 }}
],
"policies": [
{{ .Values.policies | indent 4 }}
{{ .Values.definitions.policies | indent 4 }}
],
"queues": [
{{ .Values.definitions.queues | indent 4 }}
],
"exchanges": [
{{ .Values.definitions.exchanges | indent 4 }}
],
"bindings": [
{{ .Values.definitions.bindings| indent 4 }}
]
}
{{- end -}}
+71 -10
View File
@@ -13,20 +13,81 @@ managementPassword: E9R3fjZm4ejFkVFE
extraConfig: |
# queue_master_locator = min-masters
definitions:
users: |-
# {
# "name": "myUsername",
# "password": "myPassword",
# "tags": "administrator"
# }
vhosts: |-
# {
# "name": "/rabbit"
# }
parameters: |-
# {
# "value": {
# "src-uri": "amqp://localhost",
# "src-queue": "source",
# "dest-uri": "amqp://localhost",
# "dest-queue": "destination",
# "add-forward-headers": false,
# "ack-mode": "on-confirm",
# "delete-after": "never"
# },
# "vhost": "/",
# "component": "shovel",
# "name": "test"
# }
permissions: |-
# {
# "user": "myUsername",
# "vhost": "/rabbit",
# "configure": ".*",
# "write": ".*",
# "read": ".*"
# }
queues: |-
# {
# "name":"myName",
# "vhost":"/rabbit",
# "durable":true,
# "auto_delete":false,
# "arguments":{}
# }
exchanges: |-
# {
# "name":"myName",
# "vhost":"/rabbit",
# "type":"direct",
# "durable":true,
# "auto_delete":false,
# "internal":false,
# "arguments":{}
# }
bindings: |-
# {
# "source":"myName",
# "vhost":"/rabbit",
# "destination":"myName",
# "destination_type":"queue",
# "routing_key":"myKey",
# "arguments":{}
# }
## Sets the policies in definitions.json. This can be used to control the high
## availability of queues by mirroring them to multiple nodes.
## Ref: https://www.rabbitmq.com/ha.html
policies: |-
# {
# "name": "ha-all",
# "pattern": ".*",
# "vhost": "/",
# "definition": {
# "ha-mode": "all",
# "ha-sync-mode": "automatic",
# "ha-sync-batch-size": 1
policies: |-
# {
# "name": "ha-all",
# "pattern": ".*",
# "vhost": "/",
# "definition": {
# "ha-mode": "all",
# "ha-sync-mode": "automatic",
# "ha-sync-batch-size": 1
# }
# }
# }
## RabbitMQ default VirtualHost