Use Docker healthchecks for cinder services

This change enables the use of Docker healthchecks for cinder
services.

Change-Id: I9bef02a66aae2024052078d8354059ab28a71e1e
Implements: blueprint container-health-check
This commit is contained in:
wu.chunyang 2020-12-01 15:21:29 +08:00
parent bce732a285
commit 1e9506a45b
4 changed files with 67 additions and 0 deletions

View File

@ -9,6 +9,7 @@ cinder_services:
image: "{{ cinder_api_image_full }}"
volumes: "{{ cinder_api_default_volumes + cinder_api_extra_volumes }}"
dimensions: "{{ cinder_api_dimensions }}"
healthcheck: "{{ cinder_api_healthcheck }}"
haproxy:
cinder_api:
enabled: "{{ enable_cinder }}"
@ -31,6 +32,7 @@ cinder_services:
image: "{{ cinder_scheduler_image_full }}"
volumes: "{{ cinder_scheduler_default_volumes + cinder_scheduler_extra_volumes }}"
dimensions: "{{ cinder_scheduler_dimensions }}"
healthcheck: "{{ cinder_scheduler_healthcheck }}"
cinder-volume:
container_name: cinder_volume
group: cinder-volume
@ -41,6 +43,7 @@ cinder_services:
tmpfs: "{{ cinder_volume_tmpfs }}"
volumes: "{{ cinder_volume_default_volumes + cinder_volume_extra_volumes }}"
dimensions: "{{ cinder_volume_dimensions }}"
healthcheck: "{{ cinder_volume_healthcheck }}"
cinder-backup:
container_name: cinder_backup
group: cinder-backup
@ -49,6 +52,7 @@ cinder_services:
privileged: True
volumes: "{{ cinder_backup_default_volumes + cinder_backup_extra_volumes }}"
dimensions: "{{ cinder_backup_dimensions }}"
healthcheck: "{{ cinder_backup_healthcheck }}"
####################
# Database
@ -84,6 +88,58 @@ cinder_backup_dimensions: "{{ default_container_dimensions }}"
cinder_scheduler_dimensions: "{{ default_container_dimensions }}"
cinder_volume_dimensions: "{{ default_container_dimensions }}"
cinder_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
cinder_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
cinder_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
cinder_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
cinder_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl {{ 'https' if cinder_enable_tls_backend | bool else 'http' }}://{{ api_interface_address | put_address_in_context('url') }}:{{ cinder_api_listen_port}}"]
cinder_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
cinder_api_healthcheck:
interval: "{{ cinder_api_healthcheck_interval }}"
retries: "{{ cinder_api_healthcheck_retries }}"
start_period: "{{ cinder_api_healthcheck_start_period }}"
test: "{% if cinder_api_enable_healthchecks | bool %}{{ cinder_api_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ cinder_api_healthcheck_timeout }}"
cinder_scheduler_enable_healthchecks: "{{ enable_container_healthchecks }}"
cinder_scheduler_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
cinder_scheduler_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
cinder_scheduler_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
cinder_scheduler_healthcheck_test: ["CMD-SHELL", "healthcheck_port cinder-scheduler {{ om_rpc_port }}"]
cinder_scheduler_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
cinder_scheduler_healthcheck:
interval: "{{ cinder_scheduler_healthcheck_interval }}"
retries: "{{ cinder_scheduler_healthcheck_retries }}"
start_period: "{{ cinder_scheduler_healthcheck_start_period }}"
test: "{% if cinder_scheduler_enable_healthchecks | bool %}{{ cinder_scheduler_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ cinder_scheduler_healthcheck_timeout }}"
cinder_volume_enable_healthchecks: "{{ enable_container_healthchecks }}"
cinder_volume_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
cinder_volume_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
cinder_volume_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
cinder_volume_healthcheck_test: ["CMD-SHELL", "healthcheck_port cinder-volume {{ om_rpc_port }}"]
cinder_volume_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
cinder_volume_healthcheck:
interval: "{{ cinder_volume_healthcheck_interval }}"
retries: "{{ cinder_volume_healthcheck_retries }}"
start_period: "{{ cinder_volume_healthcheck_start_period }}"
test: "{% if cinder_volume_enable_healthchecks | bool %}{{ cinder_volume_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ cinder_volume_healthcheck_timeout }}"
cinder_backup_enable_healthchecks: "{{ enable_container_healthchecks }}"
cinder_backup_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
cinder_backup_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
cinder_backup_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
cinder_backup_healthcheck_test: ["CMD-SHELL", "healthcheck_port cinder-backup {{ om_rpc_port }}"]
cinder_backup_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
cinder_backup_healthcheck:
interval: "{{ cinder_backup_healthcheck_interval }}"
retries: "{{ cinder_backup_healthcheck_retries }}"
start_period: "{{ cinder_backup_healthcheck_start_period }}"
test: "{% if cinder_backup_enable_healthchecks | bool %}{{ cinder_backup_healthcheck_test }}{% else %}NONE{% endif %}"
timeout: "{{ cinder_backup_healthcheck_timeout }}"
cinder_api_default_volumes:
- "{{ node_config_directory }}/cinder-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"
@ -44,6 +46,7 @@
tmpfs: "{{ service.tmpfs | default(omit) }}"
volumes: "{{ service.volumes | reject('equalto', '') | list }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when:
- kolla_action != "config"
@ -60,5 +63,6 @@
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes | reject('equalto', '') | list }}"
dimensions: "{{ service.dimensions }}"
healthcheck: "{{ service.healthcheck | default(omit) }}"
when:
- kolla_action != "config"

View File

@ -9,6 +9,7 @@
tmpfs: "{{ item.value.tmpfs | default(omit) }}"
volumes: "{{ item.value.volumes | reject('equalto', '') | list }}"
dimensions: "{{ item.value.dimensions }}"
healthcheck: "{{ item.value.healthcheck | default(omit) }}"
privileged: "{{ item.value.privileged | default(False) }}"
ipc_mode: "{{ item.value.ipc_mode | default('') }}"
when:

View File

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