Use Docker healthchecks for trove services

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

Change-Id: I55badd93f92f82e020ef80b06c788600e597d068
This commit is contained in:
LinPeiWen 2021-03-02 11:04:31 +00:00
parent a8981a79aa
commit 2518e926d9
4 changed files with 52 additions and 0 deletions

View File

@ -9,6 +9,7 @@ trove_services:
image: "{{ trove_api_image_full }}"
volumes: "{{ trove_api_default_volumes + trove_api_extra_volumes }}"
dimensions: "{{ trove_api_dimensions }}"
healthcheck: "{{ trove_api_healthcheck }}"
haproxy:
trove_api:
enabled: "{{ enable_trove }}"
@ -27,6 +28,7 @@ trove_services:
image: "{{ trove_conductor_image_full }}"
volumes: "{{ trove_conductor_default_volumes + trove_conductor_extra_volumes }}"
dimensions: "{{ trove_conductor_dimensions }}"
healthcheck: "{{ trove_conductor_healthcheck }}"
trove-taskmanager:
container_name: trove_taskmanager
group: trove-taskmanager
@ -34,6 +36,7 @@ trove_services:
image: "{{ trove_taskmanager_image_full }}"
volumes: "{{ trove_taskmanager_default_volumes + trove_taskmanager_extra_volumes }}"
dimensions: "{{ trove_taskmanager_dimensions }}"
healthcheck: "{{ trove_taskmanager_healthcheck }}"
####################
@ -66,6 +69,45 @@ trove_api_dimensions: "{{ default_container_dimensions }}"
trove_conductor_dimensions: "{{ default_container_dimensions }}"
trove_taskmanager_dimensions: "{{ default_container_dimensions }}"
trove_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
trove_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
trove_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
trove_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
trove_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ trove_api_port }}"]
trove_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
trove_api_healthcheck:
interval: "{{ trove_api_healthcheck_interval }}"
retries: "{{ trove_api_healthcheck_retries }}"
start_period: "{{ trove_api_healthcheck_start_period }}"
test: "{% if trove_api_enable_healthchecks | bool %}{{ trove_api_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ trove_api_healthcheck_timeout }}"
trove_conductor_enable_healthchecks: "{{ enable_container_healthchecks }}"
trove_conductor_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
trove_conductor_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
trove_conductor_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
trove_conductor_healthcheck_test: ["CMD-SHELL", "healthcheck_port trove-conductor {{ om_rpc_port }}"]
trove_conductor_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
trove_conductor_healthcheck:
interval: "{{ trove_conductor_healthcheck_interval }}"
retries: "{{ trove_conductor_healthcheck_retries }}"
start_period: "{{ trove_conductor_healthcheck_start_period }}"
test: "{% if trove_conductor_enable_healthchecks | bool %}{{ trove_conductor_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ trove_conductor_healthcheck_timeout }}"
trove_taskmanager_enable_healthchecks: "{{ enable_container_healthchecks }}"
trove_taskmanager_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
trove_taskmanager_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
trove_taskmanager_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
trove_taskmanager_healthcheck_test: ["CMD-SHELL", "healthcheck_port trove-taskmanager {{ om_rpc_port }}"]
trove_taskmanager_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
trove_taskmanager_healthcheck:
interval: "{{ trove_taskmanager_healthcheck_interval }}"
retries: "{{ trove_taskmanager_healthcheck_retries }}"
start_period: "{{ trove_taskmanager_healthcheck_start_period }}"
test: "{% if trove_taskmanager_enable_healthchecks | bool %}{{ trove_taskmanager_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ trove_taskmanager_healthcheck_timeout }}"
trove_api_default_volumes:
- "{{ node_config_directory }}/trove-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"

View File

@ -11,6 +11,7 @@
image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when:
- kolla_action != "config"
@ -26,6 +27,7 @@
image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when:
- kolla_action != "config"
@ -41,5 +43,6 @@
image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
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|reject('equalto', '')|list }}"
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 trove services.
See `blueprint
<https://blueprints.launchpad.net/kolla-ansible/+spec/container-health-check>`__