Use Docker healthchecks for solum services

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

Change-Id: If2dba2fc0adcb8587f5a12adb4e8c5e21824586a
This commit is contained in:
wuchunyang 2021-03-09 09:56:24 +08:00
parent 0d33a2f598
commit f7536fad5e
4 changed files with 67 additions and 0 deletions

View File

@ -9,6 +9,7 @@ solum_services:
image: "{{ solum_api_image_full }}"
volumes: "{{ solum_api_default_volumes + solum_api_extra_volumes }}"
dimensions: "{{ solum_api_dimensions }}"
healthcheck: "{{ solum_api_healthcheck }}"
solum-worker:
container_name: solum_worker
group: solum-worker
@ -16,6 +17,7 @@ solum_services:
image: "{{ solum_worker_image_full }}"
volumes: "{{ solum_worker_default_volumes + solum_worker_extra_volumes }}"
dimensions: "{{ solum_worker_dimensions }}"
healthcheck: "{{ solum_worker_healthcheck }}"
solum-deployer:
container_name: solum_deployer
group: solum-deployer
@ -23,6 +25,7 @@ solum_services:
image: "{{ solum_deployer_image_full }}"
volumes: "{{ solum_deployer_default_volumes + solum_deployer_extra_volumes }}"
dimensions: "{{ solum_deployer_dimensions }}"
healthcheck: "{{ solum_deployer_healthcheck }}"
haproxy:
solum_application_deployment:
enabled: "{{ enable_solum }}"
@ -55,6 +58,7 @@ solum_services:
image: "{{ solum_conductor_image_full }}"
volumes: "{{ solum_conductor_default_volumes + solum_conductor_extra_volumes }}"
dimensions: "{{ solum_conductor_dimensions }}"
healthcheck: "{{ solum_conductor_healthcheck }}"
####################
# Database
@ -91,6 +95,58 @@ solum_worker_dimensions: "{{ default_container_dimensions }}"
solum_deployer_dimensions: "{{ default_container_dimensions }}"
solum_conductor_dimensions: "{{ default_container_dimensions }}"
solum_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
solum_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
solum_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
solum_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
solum_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ solum_application_deployment_port }}"]
solum_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
solum_api_healthcheck:
interval: "{{ solum_api_healthcheck_interval }}"
retries: "{{ solum_api_healthcheck_retries }}"
start_period: "{{ solum_api_healthcheck_start_period }}"
test: "{% if solum_api_enable_healthchecks | bool %}{{ solum_api_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ solum_api_healthcheck_timeout }}"
solum_worker_enable_healthchecks: "{{ enable_container_healthchecks }}"
solum_worker_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
solum_worker_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
solum_worker_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
solum_worker_healthcheck_test: ["CMD-SHELL", "healthcheck_port solum-worker {{ om_rpc_port }}"]
solum_worker_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
solum_worker_healthcheck:
interval: "{{ solum_worker_healthcheck_interval }}"
retries: "{{ solum_worker_healthcheck_retries }}"
start_period: "{{ solum_worker_healthcheck_start_period }}"
test: "{% if solum_worker_enable_healthchecks | bool %}{{ solum_worker_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ solum_worker_healthcheck_timeout }}"
solum_deployer_enable_healthchecks: "{{ enable_container_healthchecks }}"
solum_deployer_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
solum_deployer_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
solum_deployer_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
solum_deployer_healthcheck_test: ["CMD-SHELL", "healthcheck_port solum-deployer {{ om_rpc_port }}"]
solum_deployer_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
solum_deployer_healthcheck:
interval: "{{ solum_deployer_healthcheck_interval }}"
retries: "{{ solum_deployer_healthcheck_retries }}"
start_period: "{{ solum_deployer_healthcheck_start_period }}"
test: "{% if solum_deployer_enable_healthchecks | bool %}{{ solum_deployer_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ solum_deployer_healthcheck_timeout }}"
solum_conductor_enable_healthchecks: "{{ enable_container_healthchecks }}"
solum_conductor_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
solum_conductor_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
solum_conductor_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
solum_conductor_healthcheck_test: ["CMD-SHELL", "healthcheck_port solum-conductor {{ om_rpc_port }}"]
solum_conductor_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
solum_conductor_healthcheck:
interval: "{{ solum_conductor_healthcheck_interval }}"
retries: "{{ solum_conductor_healthcheck_retries }}"
start_period: "{{ solum_conductor_healthcheck_start_period }}"
test: "{% if solum_conductor_enable_healthchecks | bool %}{{ solum_conductor_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ solum_conductor_healthcheck_timeout }}"
solum_api_default_volumes:
- "{{ node_config_directory }}/solum-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,6 +43,7 @@
image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when:
- kolla_action != "config"
@ -56,5 +59,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 solum services.
See `blueprint
<https://blueprints.launchpad.net/kolla-ansible/+spec/container-health-check>`__