Use Docker healthchecks for elasticsearch services

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

Change-Id: Ib50d56cc206a80b20a4f96e95bcdd8d11269234f
This commit is contained in:
LinPeiWen 2021-03-11 15:13:58 +00:00
parent cef8c8b3de
commit 10f79eda1d
4 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,7 @@ elasticsearch_services:
ES_JAVA_OPTS: "{{ es_java_opts }}"
volumes: "{{ elasticsearch_default_volumes + elasticsearch_extra_volumes }}"
dimensions: "{{ elasticsearch_dimensions }}"
healthcheck: "{{ elasticsearch_healthcheck }}"
haproxy:
elasticsearch:
enabled: "{{ enable_elasticsearch }}"
@ -85,6 +86,19 @@ elasticsearch_curator_image_full: "{{ elasticsearch_curator_image }}:{{ elastics
elasticsearch_dimensions: "{{ default_container_dimensions }}"
elasticsearch_curator_dimensions: "{{ default_container_dimensions }}"
elasticsearch_enable_healthchecks: "{{ enable_container_healthchecks }}"
elasticsearch_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
elasticsearch_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
elasticsearch_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
elasticsearch_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ elasticsearch_port }}"]
elasticsearch_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
elasticsearch_healthcheck:
interval: "{{ elasticsearch_healthcheck_interval }}"
retries: "{{ elasticsearch_healthcheck_retries }}"
start_period: "{{ elasticsearch_healthcheck_start_period }}"
test: "{% if elasticsearch_enable_healthchecks | bool %}{{ elasticsearch_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ elasticsearch_healthcheck_timeout }}"
elasticsearch_default_volumes:
- "{{ node_config_directory }}/elasticsearch/:{{ container_config_directory }}/"
- "/etc/localtime:/etc/localtime:ro"

View File

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

View File

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

View File

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