Use Docker healthchecks for magnum services

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

Change-Id: I14d862aa599915c781d02b71a0e57d2124de9abc
This commit is contained in:
wu.chunyang 2021-02-20 10:28:25 -05:00
parent 4d4dff0cb8
commit 26a7fc04c6
4 changed files with 37 additions and 0 deletions

View File

@ -11,6 +11,7 @@ magnum_services:
DUMMY_ENVIRONMENT: kolla_useless_env
volumes: "{{ magnum_api_default_volumes + magnum_api_extra_volumes }}"
dimensions: "{{ magnum_api_dimensions }}"
healthcheck: "{{ magnum_api_healthcheck }}"
haproxy:
magnum_api:
enabled: "{{ enable_magnum }}"
@ -30,6 +31,7 @@ magnum_services:
environment: "{{ magnum_conductor_container_proxy }}"
volumes: "{{ magnum_conductor_default_volumes + magnum_conductor_extra_volumes }}"
dimensions: "{{ magnum_conductor_dimensions }}"
healthcheck: "{{ magnum_conductor_healthcheck }}"
####################
@ -66,6 +68,32 @@ magnum_conductor_image_full: "{{ magnum_conductor_image }}:{{ magnum_conductor_t
magnum_api_dimensions: "{{ default_container_dimensions }}"
magnum_conductor_dimensions: "{{ default_container_dimensions }}"
magnum_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
magnum_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
magnum_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
magnum_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
magnum_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ magnum_api_port }}"]
magnum_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
magnum_api_healthcheck:
interval: "{{ magnum_api_healthcheck_interval }}"
retries: "{{ magnum_api_healthcheck_retries }}"
start_period: "{{ magnum_api_healthcheck_start_period }}"
test: "{% if magnum_api_enable_healthchecks | bool %}{{ magnum_api_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ magnum_api_healthcheck_timeout }}"
magnum_conductor_enable_healthchecks: "{{ enable_container_healthchecks }}"
magnum_conductor_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
magnum_conductor_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
magnum_conductor_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
magnum_conductor_healthcheck_test: ["CMD-SHELL", "healthcheck_port magnum-conductor {{ om_rpc_port }}"]
magnum_conductor_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
magnum_conductor_healthcheck:
interval: "{{ magnum_conductor_healthcheck_interval }}"
retries: "{{ magnum_conductor_healthcheck_retries }}"
start_period: "{{ magnum_conductor_healthcheck_start_period }}"
test: "{% if magnum_conductor_enable_healthchecks | bool %}{{ magnum_conductor_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ magnum_conductor_healthcheck_timeout }}"
magnum_api_default_volumes:
- "{{ node_config_directory }}/magnum-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"

View File

@ -12,6 +12,7 @@
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
environment: "{{ service.environment }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when:
- kolla_action != "config"
@ -28,5 +29,6 @@
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
environment: "{{ service.environment }}"
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) }}"
environment: "{{ item.value.environment }}"
when:
- inventory_hostname in groups[item.value.group]

View File

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