From d3e91045f51afd4ddb64c579f52daa99ac17cf0e Mon Sep 17 00:00:00 2001 From: LinPeiWen <591171850@qq.com> Date: Fri, 12 Mar 2021 01:07:39 +0000 Subject: [PATCH] Use Docker healthchecks for qdrouterd services This change enables the use of Docker healthchecks for qdrouterd services. Implements: blueprint container-health-check Change-Id: If689be90690251180972454ed0baee658cc5e895 --- ansible/roles/qdrouterd/defaults/main.yml | 15 +++++++++++++++ ansible/roles/qdrouterd/handlers/main.yml | 1 + .../roles/qdrouterd/tasks/check-containers.yml | 1 + ...althchecks-for-qdrouterd-e32981b579ea858a.yaml | 6 ++++++ 4 files changed, 23 insertions(+) create mode 100644 releasenotes/notes/implement-docker-healthchecks-for-qdrouterd-e32981b579ea858a.yaml diff --git a/ansible/roles/qdrouterd/defaults/main.yml b/ansible/roles/qdrouterd/defaults/main.yml index 4053b981bb..6c1d32217a 100644 --- a/ansible/roles/qdrouterd/defaults/main.yml +++ b/ansible/roles/qdrouterd/defaults/main.yml @@ -9,6 +9,8 @@ qdrouterd_services: image: "{{ qdrouterd_image_full }}" volumes: "{{ qdrouterd_default_volumes + qdrouterd_extra_volumes }}" dimensions: "{{ qdrouterd_dimensions }}" + healthcheck: "{{ qdrouterd_healthcheck }}" + #################### # Docker @@ -19,6 +21,19 @@ qdrouterd_tag: "{{ openstack_tag }}" qdrouterd_image_full: "{{ qdrouterd_image }}:{{ qdrouterd_tag }}" qdrouterd_dimensions: "{{ default_container_dimensions }}" +qdrouterd_enable_healthchecks: "{{ enable_container_healthchecks }}" +qdrouterd_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +qdrouterd_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +qdrouterd_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +qdrouterd_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ qdrouterd_port }}"] +qdrouterd_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +qdrouterd_healthcheck: + interval: "{{ qdrouterd_healthcheck_interval }}" + retries: "{{ qdrouterd_healthcheck_retries }}" + start_period: "{{ qdrouterd_healthcheck_start_period }}" + test: "{% if qdrouterd_enable_healthchecks | bool %}{{ qdrouterd_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ qdrouterd_healthcheck_timeout }}" + qdrouterd_default_volumes: - "{{ node_config_directory }}/qdrouterd/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/qdrouterd/handlers/main.yml b/ansible/roles/qdrouterd/handlers/main.yml index 17c6b84e47..729f221632 100644 --- a/ansible/roles/qdrouterd/handlers/main.yml +++ b/ansible/roles/qdrouterd/handlers/main.yml @@ -11,5 +11,6 @@ image: "{{ service.image }}" volumes: "{{ service.volumes }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" diff --git a/ansible/roles/qdrouterd/tasks/check-containers.yml b/ansible/roles/qdrouterd/tasks/check-containers.yml index 9566ee380f..5d713c1c33 100644 --- a/ansible/roles/qdrouterd/tasks/check-containers.yml +++ b/ansible/roles/qdrouterd/tasks/check-containers.yml @@ -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 diff --git a/releasenotes/notes/implement-docker-healthchecks-for-qdrouterd-e32981b579ea858a.yaml b/releasenotes/notes/implement-docker-healthchecks-for-qdrouterd-e32981b579ea858a.yaml new file mode 100644 index 0000000000..b14ce85b3f --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-qdrouterd-e32981b579ea858a.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for qdrouterd services. + See `blueprint + `__