aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Crees <mattc@stackhpc.com>2023-01-31 14:38:36 +0000
committerMatt Crees <mattc@stackhpc.com>2023-02-14 10:51:46 +0000
commite13072a98df3727693ead107cd54d784c4e9c1cd (patch)
tree8bc3522b5c8ac8128611007650544fb525291550
parent94f3ce0c78998e29fcc034a9b0844f9d6d602807 (diff)
downloadkolla-ansible-e13072a98df3727693ead107cd54d784c4e9c1cd.tar.gz
kolla-ansible-e13072a98df3727693ead107cd54d784c4e9c1cd.zip
Add flag to change RabbitMQ ha-mode definition
Adds the flag `rabbitmq_ha_replica_count` to change how many different nodes a queue should be mirrored across. If the value is not set, then it defaults to "ha-mode":"all". This value is unset by default to avoid any unexpected changes to the RabbitMQ definitions.json file, as that would trigger an unexpected restart of RabbitMQ during the next deploy. Change-Id: Iee98cd937197a73a3b04aa8501fa325e8ecfff24
-rw-r--r--ansible/roles/rabbitmq/defaults/main.yml4
-rw-r--r--ansible/roles/rabbitmq/templates/definitions.json.j24
-rw-r--r--releasenotes/notes/rabbitmq-ha-flag-to-change-replication-factor-321c2f9e08e7d179.yaml9
-rwxr-xr-xtools/validate-all-file.py1
4 files changed, 16 insertions, 2 deletions
diff --git a/ansible/roles/rabbitmq/defaults/main.yml b/ansible/roles/rabbitmq/defaults/main.yml
index 06aaf8a9c..ee983d672 100644
--- a/ansible/roles/rabbitmq/defaults/main.yml
+++ b/ansible/roles/rabbitmq/defaults/main.yml
@@ -89,6 +89,10 @@ rabbitmq_cluster_partition_handling: "pause_minority"
# More details see:
# https://www.rabbitmq.com/ha.html#promoting-unsynchronised-mirrors
rabbitmq_ha_promote_on_shutdown:
+# If no replica count is specified, replicates across all nodes with definition
+# "ha-mode":"all". Otherwise, uses
+# "ha-mode":"exactly","ha-params":{{ rabbitmq_ha_replica_count | int }}
+rabbitmq_ha_replica_count:
rabbitmq_extra_config: {}
####################
diff --git a/ansible/roles/rabbitmq/templates/definitions.json.j2 b/ansible/roles/rabbitmq/templates/definitions.json.j2
index d04a0deab..4bf42d948 100644
--- a/ansible/roles/rabbitmq/templates/definitions.json.j2
+++ b/ansible/roles/rabbitmq/templates/definitions.json.j2
@@ -18,8 +18,8 @@
],
{% if om_enable_rabbitmq_high_availability | bool %}
"policies":[
- {"vhost": "/", "name": "ha-all", "pattern": "^(?!(amq\\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":"all"{% if rabbitmq_ha_promote_on_shutdown is not none %},"ha-promote-on-shutdown":"{{ rabbitmq_ha_promote_on_shutdown }}"{% endif %}}, "priority":0}{% if project_name == 'outward_rabbitmq' %},
- {"vhost": "{{ murano_agent_rabbitmq_vhost }}", "name": "ha-all", "pattern": "^(?!(amq\\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":"all"{% if rabbitmq_ha_promote_on_shutdown is not none %},"ha-promote-on-shutdown":"{{ rabbitmq_ha_promote_on_shutdown }}"{% endif %}}, "priority":0}
+ {"vhost": "/", "name": "ha-all", "pattern": "^(?!(amq\\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":{% if rabbitmq_ha_replica_count is not none %}"exactly","ha-params":{{ rabbitmq_ha_replica_count | int }}{% else %}"all"{% endif %}{% if rabbitmq_ha_promote_on_shutdown is not none %},"ha-promote-on-shutdown":"{{ rabbitmq_ha_promote_on_shutdown }}"{% endif %}}, "priority":0}{% if project_name == 'outward_rabbitmq' %},
+ {"vhost": "{{ murano_agent_rabbitmq_vhost }}", "name": "ha-all", "pattern": "^(?!(amq\\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":{% if rabbitmq_ha_replica_count is not none %}"exactly","ha-params":{{ rabbitmq_ha_replica_count | int }}{% else %}"all"{% endif %}{% if rabbitmq_ha_promote_on_shutdown is not none %},"ha-promote-on-shutdown":"{{ rabbitmq_ha_promote_on_shutdown }}"{% endif %}}, "priority":0}
{% endif %}
]
{% else %}
diff --git a/releasenotes/notes/rabbitmq-ha-flag-to-change-replication-factor-321c2f9e08e7d179.yaml b/releasenotes/notes/rabbitmq-ha-flag-to-change-replication-factor-321c2f9e08e7d179.yaml
new file mode 100644
index 000000000..53c05998e
--- /dev/null
+++ b/releasenotes/notes/rabbitmq-ha-flag-to-change-replication-factor-321c2f9e08e7d179.yaml
@@ -0,0 +1,9 @@
+---
+features:
+ - |
+ The config option `rabbitmq_ha_replica_count` is added, to allow for
+ changing the replication factor of mirrored queues in RabbitMQ. While the
+ flag is unset, the queues are mirrored across all nodes using
+ "ha-mode":"all". Note that this only has an effect if the flag
+ ` om_enable_rabbitmq_high_availability` is set to `True`, as otherwise
+ queues are not mirrored.
diff --git a/tools/validate-all-file.py b/tools/validate-all-file.py
index dc16bf382..763020e52 100755
--- a/tools/validate-all-file.py
+++ b/tools/validate-all-file.py
@@ -127,6 +127,7 @@ def check_json_j2():
'api_interface_address': '',
'kolla_internal_fqdn': '',
'octavia_provider_drivers': '',
+ 'rabbitmq_ha_replica_count': 2,
}
data = template.render(**context)
json.loads(data)