Use Docker healthchecks for kafka services

This change enables the use of Docker healthchecks for kafka services.
Implements: blueprint container-health-check

Change-Id: I31c978be7f8687de1e41b168712aceed28c67a8a
This commit is contained in:
LinPeiWen 2021-03-08 10:44:02 +00:00
parent cef8c8b3de
commit 72df931b58
4 changed files with 23 additions and 0 deletions

View File

@ -12,6 +12,8 @@ kafka_services:
KAFKA_HEAP_OPTS: "{{ kafka_heap_opts }}"
volumes: "{{ kafka_default_volumes + kafka_extra_volumes }}"
dimensions: "{{ kafka_dimensions }}"
healthcheck: "{{ kafka_healthcheck }}"
####################
# Kafka
@ -30,6 +32,19 @@ kafka_tag: "{{ openstack_tag }}"
kafka_image_full: "{{ kafka_image }}:{{ kafka_tag }}"
kafka_dimensions: "{{ default_container_dimensions }}"
kafka_enable_healthchecks: "{{ enable_container_healthchecks }}"
kafka_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
kafka_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
kafka_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
kafka_healthcheck_test: ["CMD-SHELL", "healthcheck_listen java {{ kafka_port }}"]
kafka_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
kafka_healthcheck:
interval: "{{ kafka_healthcheck_interval }}"
retries: "{{ kafka_healthcheck_retries }}"
start_period: "{{ kafka_healthcheck_start_period }}"
test: "{% if kafka_enable_healthchecks | bool %}{{ kafka_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ kafka_healthcheck_timeout }}"
kafka_default_volumes:
- "{{ node_config_directory }}/kafka/:{{ container_config_directory }}/"
- "/etc/localtime:/etc/localtime:ro"

View File

@ -12,5 +12,6 @@
environment: "{{ service.environment }}"
volumes: "{{ service.volumes }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when:
- kolla_action != "config"

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

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