Use Docker healthchecks for barbican services

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

Change-Id: Iffda6569103f95733bd7fb80aef31c6a608a55b7
This commit is contained in:
wu.chunyang 2020-12-02 22:04:13 +08:00
parent bce732a285
commit 9d66238285
4 changed files with 52 additions and 0 deletions

View File

@ -9,6 +9,7 @@ barbican_services:
image: "{{ barbican_api_image_full }}" image: "{{ barbican_api_image_full }}"
volumes: "{{ barbican_api_default_volumes + barbican_api_extra_volumes }}" volumes: "{{ barbican_api_default_volumes + barbican_api_extra_volumes }}"
dimensions: "{{ barbican_api_dimensions }}" dimensions: "{{ barbican_api_dimensions }}"
healthcheck: "{{ barbican_api_healthcheck }}"
haproxy: haproxy:
barbican_api: barbican_api:
enabled: "{{ enable_barbican }}" enabled: "{{ enable_barbican }}"
@ -31,6 +32,7 @@ barbican_services:
image: "{{ barbican_keystone_listener_image_full }}" image: "{{ barbican_keystone_listener_image_full }}"
volumes: "{{ barbican_keystone_listener_default_volumes + barbican_keystone_listener_extra_volumes }}" volumes: "{{ barbican_keystone_listener_default_volumes + barbican_keystone_listener_extra_volumes }}"
dimensions: "{{ barbican_keystone_listener_dimensions }}" dimensions: "{{ barbican_keystone_listener_dimensions }}"
healthcheck: "{{ barbican_keystone_listener_healthcheck }}"
barbican-worker: barbican-worker:
container_name: barbican_worker container_name: barbican_worker
group: barbican-worker group: barbican-worker
@ -38,6 +40,7 @@ barbican_services:
image: "{{ barbican_worker_image_full }}" image: "{{ barbican_worker_image_full }}"
volumes: "{{ barbican_worker_default_volumes + barbican_worker_extra_volumes }}" volumes: "{{ barbican_worker_default_volumes + barbican_worker_extra_volumes }}"
dimensions: "{{ barbican_worker_dimensions }}" dimensions: "{{ barbican_worker_dimensions }}"
healthcheck: "{{ barbican_worker_healthcheck }}"
#################### ####################
@ -70,6 +73,45 @@ barbican_api_dimensions: "{{ default_container_dimensions }}"
barbican_keystone_listener_dimensions: "{{ default_container_dimensions }}" barbican_keystone_listener_dimensions: "{{ default_container_dimensions }}"
barbican_worker_dimensions: "{{ default_container_dimensions }}" barbican_worker_dimensions: "{{ default_container_dimensions }}"
barbican_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
barbican_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
barbican_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
barbican_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
barbican_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl {{ 'https' if barbican_enable_tls_backend | bool else 'http' }}://{{ api_interface_address | put_address_in_context('url') }}:{{ barbican_api_listen_port}}"]
barbican_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
barbican_api_healthcheck:
interval: "{{ barbican_api_healthcheck_interval }}"
retries: "{{ barbican_api_healthcheck_retries }}"
start_period: "{{ barbican_api_healthcheck_start_period }}"
test: "{% if barbican_api_enable_healthchecks | bool %}{{ barbican_api_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ barbican_api_healthcheck_timeout }}"
barbican_keystone_listener_enable_healthchecks: "{{ enable_container_healthchecks }}"
barbican_keystone_listener_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
barbican_keystone_listener_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
barbican_keystone_listener_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
barbican_keystone_listener_healthcheck_test: ["CMD-SHELL", "healthcheck_port barbican-keystone-listener {{ om_rpc_port }}"]
barbican_keystone_listener_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
barbican_keystone_listener_healthcheck:
interval: "{{ barbican_keystone_listener_healthcheck_interval }}"
retries: "{{ barbican_keystone_listener_healthcheck_retries }}"
start_period: "{{ barbican_keystone_listener_healthcheck_start_period }}"
test: "{% if barbican_keystone_listener_enable_healthchecks | bool %}{{ barbican_keystone_listener_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ barbican_keystone_listener_healthcheck_timeout }}"
barbican_worker_enable_healthchecks: "{{ enable_container_healthchecks }}"
barbican_worker_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
barbican_worker_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
barbican_worker_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
barbican_worker_healthcheck_test: ["CMD-SHELL", "healthcheck_port barbican-worker {{ om_rpc_port }}"]
barbican_worker_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
barbican_worker_healthcheck:
interval: "{{ barbican_worker_healthcheck_interval }}"
retries: "{{ barbican_worker_healthcheck_retries }}"
start_period: "{{ barbican_worker_healthcheck_start_period }}"
test: "{% if barbican_worker_enable_healthchecks | bool %}{{ barbican_worker_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ barbican_worker_healthcheck_timeout }}"
barbican_api_default_volumes: barbican_api_default_volumes:
- "{{ node_config_directory }}/barbican-api/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/barbican-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"

View File

@ -11,6 +11,7 @@
image: "{{ service.image }}" image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}" dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when: when:
- kolla_action != "config" - kolla_action != "config"
@ -26,6 +27,7 @@
image: "{{ service.image }}" image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}" dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when: when:
- kolla_action != "config" - kolla_action != "config"
@ -41,5 +43,6 @@
image: "{{ service.image }}" image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}" dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when: when:
- kolla_action != "config" - kolla_action != "config"

View File

@ -8,6 +8,7 @@
image: "{{ item.value.image }}" image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes|reject('equalto', '')|list }}" volumes: "{{ item.value.volumes|reject('equalto', '')|list }}"
dimensions: "{{ item.value.dimensions }}" dimensions: "{{ item.value.dimensions }}"
healthcheck: "{{ item.value.healthcheck | default(omit) }}"
when: when:
- inventory_hostname in groups[item.value.group] - inventory_hostname in groups[item.value.group]
- item.value.enabled | bool - item.value.enabled | bool

View File

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