Use Docker healthchecks for kuryr services

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

Change-Id: Ia4401f97140e2c2acc37d5ee3aaf90544747c547
This commit is contained in:
wuchunyang 2021-03-11 21:03:46 +08:00
parent 3c5e0f9f28
commit 2db0a2a62d
4 changed files with 22 additions and 0 deletions

View File

@ -19,6 +19,7 @@ kuryr_services:
- NET_ADMIN
volumes: "{{ kuryr_default_volumes + kuryr_extra_volumes }}"
dimensions: "{{ kuryr_dimensions }}"
healthcheck: "{{ kuryr_healthcheck }}"
####################
@ -29,6 +30,19 @@ kuryr_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_na
kuryr_tag: "{{ openstack_tag }}"
kuryr_image_full: "{{ kuryr_image }}:{{ kuryr_tag }}"
kuryr_enable_healthchecks: "{{ enable_container_healthchecks }}"
kuryr_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
kuryr_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
kuryr_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
kuryr_healthcheck_test: ["CMD-SHELL", "healthcheck_listen kuryr-server {{ kuryr_port }}"]
kuryr_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
kuryr_healthcheck:
interval: "{{ kuryr_healthcheck_interval }}"
retries: "{{ kuryr_healthcheck_retries }}"
start_period: "{{ kuryr_healthcheck_start_period }}"
test: "{% if kuryr_enable_healthchecks | bool %}{{ kuryr_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ kuryr_healthcheck_timeout }}"
kuryr_default_volumes:
- "{{ node_config_directory }}/kuryr/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"

View File

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

View File

@ -10,6 +10,7 @@
cap_add: "{{ item.value.cap_add }}"
volumes: "{{ item.value.volumes }}"
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 zun services.
See `blueprint
<https://blueprints.launchpad.net/kolla-ansible/+spec/container-health-check>`__