Use Docker healthchecks for rabbitmq services

This change enables the use of Docker healthchecks for rabbitmq services.

Implements: blueprint container-health-check
Depends-On: https://review.opendev.org/c/openstack/kolla/+/784562

Change-Id: I23a2c2efab858b9ed39c6ce0ec4a82df10e7f93d
This commit is contained in:
LinPeiWen 2021-03-13 06:33:13 +00:00 committed by Lin PeiWen
parent 09fcfe8cd2
commit 1ddef85973
4 changed files with 22 additions and 0 deletions

View File

@ -18,6 +18,7 @@ rabbitmq_services:
RABBITMQ_LOG_DIR: "/var/log/kolla/{{ project_name }}"
volumes: "{{ rabbitmq_default_volumes + rabbitmq_extra_volumes }}"
dimensions: "{{ rabbitmq_dimensions }}"
healthcheck: "{{ rabbitmq_healthcheck }}"
haproxy:
rabbitmq_management:
enabled: "{{ enable_rabbitmq }}"
@ -56,6 +57,19 @@ rabbitmq_tag: "{{ openstack_tag }}"
rabbitmq_image_full: "{{ rabbitmq_image }}:{{ rabbitmq_tag }}"
rabbitmq_dimensions: "{{ default_container_dimensions }}"
rabbitmq_enable_healthchecks: "{{ enable_container_healthchecks }}"
rabbitmq_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
rabbitmq_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
rabbitmq_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
rabbitmq_healthcheck_test: ["CMD-SHELL", "healthcheck_rabbitmq"]
rabbitmq_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
rabbitmq_healthcheck:
interval: "{{ rabbitmq_healthcheck_interval }}"
retries: "{{ rabbitmq_healthcheck_retries }}"
start_period: "{{ rabbitmq_healthcheck_start_period }}"
test: "{% if rabbitmq_enable_healthchecks | bool %}{{ rabbitmq_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ rabbitmq_healthcheck_timeout }}"
rabbitmq_default_volumes:
- "{{ node_config_directory }}/{{ project_name }}/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"

View File

@ -9,6 +9,7 @@
volumes: "{{ item.value.volumes }}"
environment: "{{ item.value.environment }}"
dimensions: "{{ item.value.dimensions }}"
healthcheck: "{{ item.value.healthcheck | default(omit) }}"
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool

View File

@ -12,6 +12,7 @@
volumes: "{{ service.volumes }}"
environment: "{{ service.environment }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
- name: Waiting for rabbitmq to start
vars:

View File

@ -0,0 +1,6 @@
---
features:
- |
Implements container healthchecks for rabbitmq services.
See `blueprint
<https://blueprints.launchpad.net/kolla-ansible/+spec/container-health-check>`__