Use Docker healthchecks for octavia services

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

Change-Id: I2ec11544b0e9c66a1821bfe0f9a40a9e9d88033b
This commit is contained in:
LinPeiWen 2021-03-02 12:11:02 +00:00
parent e315446291
commit 5c2d1c90be
4 changed files with 67 additions and 0 deletions

View File

@ -9,6 +9,7 @@ octavia_services:
image: "{{ octavia_api_image_full }}"
volumes: "{{ octavia_api_default_volumes + octavia_api_extra_volumes }}"
dimensions: "{{ octavia_api_dimensions }}"
healthcheck: "{{ octavia_api_healthcheck }}"
haproxy:
octavia_api:
enabled: "{{ enable_octavia }}"
@ -27,6 +28,7 @@ octavia_services:
image: "{{ octavia_health_manager_image_full }}"
volumes: "{{ octavia_health_manager_default_volumes + octavia_health_manager_extra_volumes }}"
dimensions: "{{ octavia_health_manager_dimensions }}"
healthcheck: "{{ octavia_health_manager_healthcheck }}"
octavia-housekeeping:
container_name: octavia_housekeeping
group: octavia-housekeeping
@ -34,6 +36,7 @@ octavia_services:
image: "{{ octavia_housekeeping_image_full }}"
volumes: "{{ octavia_housekeeping_default_volumes + octavia_housekeeping_extra_volumes }}"
dimensions: "{{ octavia_housekeeping_dimensions }}"
healthcheck: "{{ octavia_housekeeping_healthcheck }}"
octavia-worker:
container_name: octavia_worker
group: octavia-worker
@ -41,6 +44,7 @@ octavia_services:
image: "{{ octavia_worker_image_full }}"
volumes: "{{ octavia_worker_default_volumes + octavia_worker_extra_volumes }}"
dimensions: "{{ octavia_worker_dimensions }}"
healthcheck: "{{ octavia_worker_healthcheck }}"
octavia_required_roles:
- load-balancer_observer
@ -85,6 +89,58 @@ octavia_health_manager_dimensions: "{{ default_container_dimensions }}"
octavia_housekeeping_dimensions: "{{ default_container_dimensions }}"
octavia_worker_dimensions: "{{ default_container_dimensions }}"
octavia_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
octavia_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
octavia_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
octavia_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
octavia_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ octavia_api_listen_port }}"]
octavia_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
octavia_api_healthcheck:
interval: "{{ octavia_api_healthcheck_interval }}"
retries: "{{ octavia_api_healthcheck_retries }}"
start_period: "{{ octavia_api_healthcheck_start_period }}"
test: "{% if octavia_api_enable_healthchecks | bool %}{{ octavia_api_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ octavia_api_healthcheck_timeout }}"
octavia_health_manager_enable_healthchecks: "{{ enable_container_healthchecks }}"
octavia_health_manager_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
octavia_health_manager_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
octavia_health_manager_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
octavia_health_manager_healthcheck_test: ["CMD-SHELL", "healthcheck_port octavia-health-manager {{ database_port }}"]
octavia_health_manager_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
octavia_health_manager_healthcheck:
interval: "{{ octavia_health_manager_healthcheck_interval }}"
retries: "{{ octavia_health_manager_healthcheck_retries }}"
start_period: "{{ octavia_health_manager_healthcheck_start_period }}"
test: "{% if octavia_health_manager_enable_healthchecks | bool %}{{ octavia_health_manager_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ octavia_health_manager_healthcheck_timeout }}"
octavia_housekeeping_enable_healthchecks: "{{ enable_container_healthchecks }}"
octavia_housekeeping_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
octavia_housekeeping_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
octavia_housekeeping_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
octavia_housekeeping_healthcheck_test: ["CMD-SHELL", "healthcheck_port octavia-housekeeping {{ database_port }}"]
octavia_housekeeping_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
octavia_housekeeping_healthcheck:
interval: "{{ octavia_housekeeping_healthcheck_interval }}"
retries: "{{ octavia_housekeeping_healthcheck_retries }}"
start_period: "{{ octavia_housekeeping_healthcheck_start_period }}"
test: "{% if octavia_housekeeping_enable_healthchecks | bool %}{{ octavia_housekeeping_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ octavia_housekeeping_healthcheck_timeout }}"
octavia_worker_enable_healthchecks: "{{ enable_container_healthchecks }}"
octavia_worker_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
octavia_worker_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
octavia_worker_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
octavia_worker_healthcheck_test: ["CMD-SHELL", "healthcheck_port octavia-worker {{ om_rpc_port }}"]
octavia_worker_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
octavia_worker_healthcheck:
interval: "{{ octavia_worker_healthcheck_interval }}"
retries: "{{ octavia_worker_healthcheck_retries }}"
start_period: "{{ octavia_worker_healthcheck_start_period }}"
test: "{% if octavia_worker_enable_healthchecks | bool %}{{ octavia_worker_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ octavia_worker_healthcheck_timeout }}"
octavia_api_default_volumes:
- "{{ node_config_directory }}/octavia-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 }}"
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 octavia services.
See `blueprint
<https://blueprints.launchpad.net/kolla-ansible/+spec/container-health-check>`__