Use Docker healthchecks for cloudkitty services

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

Change-Id: I19892035382ffff5200e88da53408a19e72c9d68
This commit is contained in:
wu.chunyang 2020-12-21 11:16:39 +08:00
parent bce732a285
commit e6e7e4d5d6
4 changed files with 37 additions and 0 deletions

View File

@ -9,6 +9,7 @@ cloudkitty_services:
enabled: True enabled: True
volumes: "{{ cloudkitty_api_default_volumes + cloudkitty_api_extra_volumes }}" volumes: "{{ cloudkitty_api_default_volumes + cloudkitty_api_extra_volumes }}"
dimensions: "{{ cloudkitty_api_dimensions }}" dimensions: "{{ cloudkitty_api_dimensions }}"
healthcheck: "{{ cloudkitty_api_healthcheck }}"
haproxy: haproxy:
cloudkitty_api: cloudkitty_api:
enabled: "{{ enable_cloudkitty }}" enabled: "{{ enable_cloudkitty }}"
@ -27,6 +28,7 @@ cloudkitty_services:
enabled: True enabled: True
volumes: "{{ cloudkitty_processor_default_volumes + cloudkitty_processor_extra_volumes }}" volumes: "{{ cloudkitty_processor_default_volumes + cloudkitty_processor_extra_volumes }}"
dimensions: "{{ cloudkitty_processor_dimensions }}" dimensions: "{{ cloudkitty_processor_dimensions }}"
healthcheck: "{{ cloudkitty_processor_healthcheck }}"
#################### ####################
@ -67,6 +69,32 @@ cloudkitty_processor_default_volumes:
- "kolla_logs:/var/log/kolla/" - "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/cloudkitty/cloudkitty:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/cloudkitty' if cloudkitty_dev_mode | bool else '' }}" - "{{ kolla_dev_repos_directory ~ '/cloudkitty/cloudkitty:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/cloudkitty' if cloudkitty_dev_mode | bool else '' }}"
cloudkitty_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
cloudkitty_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
cloudkitty_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
cloudkitty_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
cloudkitty_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ cloudkitty_api_port}}"]
cloudkitty_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
cloudkitty_api_healthcheck:
interval: "{{ cloudkitty_api_healthcheck_interval }}"
retries: "{{ cloudkitty_api_healthcheck_retries }}"
start_period: "{{ cloudkitty_api_healthcheck_start_period }}"
test: "{% if cloudkitty_api_enable_healthchecks | bool %}{{ cloudkitty_api_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ cloudkitty_api_healthcheck_timeout }}"
cloudkitty_processor_enable_healthchecks: "{{ enable_container_healthchecks }}"
cloudkitty_processor_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
cloudkitty_processor_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
cloudkitty_processor_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
cloudkitty_processor_healthcheck_test: ["CMD-SHELL", "healthcheck_port cloudkitty-processor {{ om_rpc_port }}"]
cloudkitty_processor_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
cloudkitty_processor_healthcheck:
interval: "{{ cloudkitty_processor_healthcheck_interval }}"
retries: "{{ cloudkitty_processor_healthcheck_retries }}"
start_period: "{{ cloudkitty_processor_healthcheck_start_period }}"
test: "{% if cloudkitty_processor_enable_healthchecks | bool %}{{ cloudkitty_processor_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ cloudkitty_processor_healthcheck_timeout }}"
cloudkitty_extra_volumes: "{{ default_extra_volumes }}" cloudkitty_extra_volumes: "{{ default_extra_volumes }}"
cloudkitty_processor_extra_volumes: "{{ cloudkitty_extra_volumes }}" cloudkitty_processor_extra_volumes: "{{ cloudkitty_extra_volumes }}"
cloudkitty_api_extra_volumes: "{{ cloudkitty_extra_volumes }}" cloudkitty_api_extra_volumes: "{{ cloudkitty_extra_volumes }}"

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,5 +27,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 cloudkitty services.
See `blueprint
<https://blueprints.launchpad.net/kolla-ansible/+spec/container-health-check>`__