Add quorum queues support for service

This change implements and enables by default quorum support
for rabbitmq as well as providing default variables to globally tune
it's behaviour.

In order to ensure upgrade path and ability to switch back to HA queues
we change vhost names with removing leading `/`, as enabling quorum
requires to remove exchange which is tricky thing to do with running
services.

Change-Id: I49f9a18430f4912fe3e2fda36da6ad2acf6dde35
This commit is contained in:
Dmitriy Rabotyagov 2023-10-20 11:16:50 +02:00 committed by Dmitriy Rabotyagov
parent 101e63e17a
commit 9b16df267a
3 changed files with 28 additions and 3 deletions

View File

@ -190,7 +190,13 @@ masakari_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}"
masakari_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}"
masakari_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}"
masakari_oslomsg_rpc_userid: masakari
masakari_oslomsg_rpc_vhost: /masakari
# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues
# are not used - vhost name will be prefixed with leading `/`.
masakari_oslomsg_rpc_vhost:
- name: /masakari
state: "{{ masakari_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}"
- name: masakari
state: "{{ masakari_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}"
masakari_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}"
masakari_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}"
@ -208,6 +214,11 @@ masakari_oslomsg_notify_vhost: "{{ masakari_oslomsg_rpc_vhost }}"
masakari_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}"
masakari_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}"
## RabbitMQ integration
masakari_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}"
masakari_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}"
masakari_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}"
## (Qdrouterd) integration
# TODO(ansmith): Change structure when more backends will be supported
masakari_oslomsg_amqp1_enabled: "{{ masakari_oslomsg_rpc_transport == 'amqp' }}"

View File

@ -1,6 +1,6 @@
[DEFAULT]
enabled_apis = masakari_api
transport_url = {{ masakari_oslomsg_rpc_transport }}://{% for host in masakari_oslomsg_rpc_servers.split(',') %}{{ masakari_oslomsg_rpc_userid }}:{{ masakari_oslomsg_rpc_password }}@{{ host }}:{{ masakari_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ masakari_oslomsg_rpc_vhost }}{% if masakari_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ masakari_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ masakari_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ masakari_oslomsg_rpc_transport }}://{% for host in masakari_oslomsg_rpc_servers.split(',') %}{{ masakari_oslomsg_rpc_userid }}:{{ masakari_oslomsg_rpc_password }}@{{ host }}:{{ masakari_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _masakari_oslomsg_rpc_vhost_conf }}{% if masakari_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ masakari_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ masakari_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
# Enable to specify listening IP other than default
masakari_api_listen = {{ masakari_api_bind_address }}
# Enable to specify port other than default
@ -67,6 +67,9 @@ process_all_instances = false
[oslo_messaging_rabbit]
ssl = {{ masakari_oslomsg_notify_use_ssl | bool }}
rabbit_quorum_queue = {{ masakari_oslomsg_rabbit_quorum_queues }}
rabbit_quorum_delivery_limit = {{ masakari_oslomsg_rabbit_quorum_delivery_limit }}
rabbit_quorum_max_memory_bytes = {{ masakari_oslomsg_rabbit_quorum_max_memory_bytes }}
[oslo_messaging_notifications]
transport_url = {{ masakari_oslomsg_notify_transport }}://{% for host in masakari_oslomsg_notify_servers.split(',') %}{{ masakari_oslomsg_notify_userid }}:{{ masakari_oslomsg_notify_password }}@{{ host }}:{{ masakari_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ masakari_oslomsg_notify_vhost }}{% if masakari_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ masakari_oslomsg_notify_ssl_version }}&ssl_ca_file={{ masakari_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ masakari_oslomsg_notify_transport }}://{% for host in masakari_oslomsg_notify_servers.split(',') %}{{ masakari_oslomsg_notify_userid }}:{{ masakari_oslomsg_notify_password }}@{{ host }}:{{ masakari_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _masakari_oslomsg_notify_vhost_conf }}{% if masakari_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ masakari_oslomsg_notify_ssl_version }}&ssl_ca_file={{ masakari_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}

View File

@ -18,6 +18,17 @@ _masakari_is_first_play_host: >-
(masakari_services['masakari-api']['group'] in group_names and
inventory_hostname == (groups[masakari_services['masakari-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_masakari_oslomsg_rpc_vhost_conf: >-
{{
(masakari_oslomsg_rpc_vhost is string) | ternary(
masakari_oslomsg_rpc_vhost, masakari_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
_masakari_oslomsg_notify_vhost_conf: >-
{{
(masakari_oslomsg_notify_vhost is string) | ternary(
masakari_oslomsg_notify_vhost, masakari_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
masakari_pip_venv_packages: |-
{% set pip_packages = [] %}