Use Docker healthchecks for sahara services

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

Change-Id: I091ce194cc3180d500e287832810b499d7b100be
This commit is contained in:
wu.chunyang 2021-02-21 07:46:26 -05:00
parent 4d4dff0cb8
commit 2bc50cd64e
4 changed files with 37 additions and 0 deletions

View File

@ -9,6 +9,7 @@ sahara_services:
image: "{{ sahara_api_image_full }}"
volumes: "{{ sahara_api_default_volumes + sahara_api_extra_volumes }}"
dimensions: "{{ sahara_api_dimensions }}"
healthcheck: "{{ sahara_api_healthcheck }}"
haproxy:
sahara_api:
enabled: "{{ enable_sahara }}"
@ -28,6 +29,7 @@ sahara_services:
privileged: True
volumes: "{{ sahara_engine_default_volumes + sahara_engine_extra_volumes }}"
dimensions: "{{ sahara_engine_dimensions }}"
healthcheck: "{{ sahara_engine_healthcheck }}"
####################
@ -55,6 +57,32 @@ sahara_api_image_full: "{{ sahara_api_image }}:{{ sahara_api_tag }}"
sahara_api_dimensions: "{{ default_container_dimensions }}"
sahara_engine_dimensions: "{{ default_container_dimensions }}"
sahara_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
sahara_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
sahara_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
sahara_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
sahara_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ sahara_api_port }}"]
sahara_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
sahara_api_healthcheck:
interval: "{{ sahara_api_healthcheck_interval }}"
retries: "{{ sahara_api_healthcheck_retries }}"
start_period: "{{ sahara_api_healthcheck_start_period }}"
test: "{% if sahara_api_enable_healthchecks | bool %}{{ sahara_api_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ sahara_api_healthcheck_timeout }}"
sahara_engine_enable_healthchecks: "{{ enable_container_healthchecks }}"
sahara_engine_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
sahara_engine_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
sahara_engine_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
sahara_engine_healthcheck_test: ["CMD-SHELL", "healthcheck_port sahara_engine {{ om_rpc_port }}"]
sahara_engine_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
sahara_engine_healthcheck:
interval: "{{ sahara_engine_healthcheck_interval }}"
retries: "{{ sahara_engine_healthcheck_retries }}"
start_period: "{{ sahara_engine_healthcheck_start_period }}"
test: "{% if sahara_engine_enable_healthchecks | bool %}{{ sahara_engine_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ sahara_engine_healthcheck_timeout }}"
sahara_api_default_volumes:
- "{{ node_config_directory }}/sahara-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"
@ -27,5 +28,6 @@
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
privileged: "{{ service.privileged | default(False) }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when:
- kolla_action != "config"

View File

@ -9,6 +9,7 @@
privileged: "{{ item.value.privileged | default(False) }}"
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 sahara services.
See `blueprint
<https://blueprints.launchpad.net/kolla-ansible/+spec/container-health-check>`__