rabbitmq: Do not stop containers on upgrade

Since RMQ 3.8 we can use rolling upgrade [1].

Depends-On: https://review.opendev.org/c/openstack/kolla/+/872393

[1]: https://www.rabbitmq.com/upgrade.html#rolling-upgrades

Change-Id: If6a7c6c12d9226a2406728108b3c87b3485ac55f
This commit is contained in:
Michal Nasiadka 2022-10-21 12:00:09 +02:00
parent 717eb8c14f
commit b30c7bc87b
5 changed files with 26 additions and 37 deletions

View File

@ -118,3 +118,10 @@ rabbitmq_plugins:
enabled: "{{ rabbitmq_enable_prometheus_plugin | bool }}"
rabbitmq_enabled_plugins: "{{ rabbitmq_plugins | selectattr('enabled', 'equalto', true) | list }}"
rabbitmq_feature_flags:
- "quorum_queue"
- "implicit_default_bindings"
- "virtual_host_metadata"
- "maintenance_mode_status"
- "user_limits"

View File

@ -7,3 +7,5 @@
- name: Flush handlers
meta: flush_handlers
- import_tasks: feature-flags.yml

View File

@ -0,0 +1,10 @@
---
- name: Enable feature flags
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: "community.rabbitmq.rabbitmq_feature_flag"
module_args:
name: "{{ item }}"
user: root
become: true
loop: "{{ rabbitmq_feature_flags }}"

View File

@ -1,44 +1,9 @@
---
# NOTE(pbourke): These tasks perform a 'full stop upgrade', which is necessary when moving between
# major releases. In future kolla-ansible releases we may be able to change this to a rolling
# restart. For info on this process see https://www.rabbitmq.com/upgrade.html
- name: Checking if rabbitmq container needs upgrading
vars:
service_name: "rabbitmq"
service: "{{ rabbitmq_services[service_name] }}"
become: true
kolla_docker:
action: "compare_image"
common_options: "{{ docker_common_options }}"
name: "{{ project_name }}"
image: "{{ rabbitmq_image_full }}"
environment: "{{ service.environment }}"
when: inventory_hostname in groups[role_rabbitmq_groups]
register: rabbitmq_differs
- import_tasks: config.yml
- import_tasks: feature-flags.yml
- import_tasks: check-containers.yml
- name: Stopping all rabbitmq instances but the first node
become: true
kolla_docker:
action: "stop_container"
common_options: "{{ docker_common_options }}"
name: "{{ project_name }}"
when:
- inventory_hostname != groups[role_rabbitmq_groups] | first
- rabbitmq_differs['result']
- name: Stopping rabbitmq on the first node
become: true
kolla_docker:
action: "stop_container"
common_options: "{{ docker_common_options }}"
name: "{{ project_name }}"
when:
- inventory_hostname == groups[role_rabbitmq_groups] | first
- rabbitmq_differs['result']
- name: Flush handlers
meta: flush_handlers

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Changes ``rabbitmq`` upgrade procedure from full stop of a cluster to
a rolling upgrade that is supported since RabbitMQ 3.8.