From 28dbde6add3038d3c7a4f4399bd7525be3d12df0 Mon Sep 17 00:00:00 2001 From: LinPeiWen <591171850@qq.com> Date: Thu, 11 Mar 2021 11:28:12 +0000 Subject: [PATCH] Use Docker healthchecks for kibana services This change enables the use of Docker healthchecks for kibana services. Implements: blueprint container-health-check Change-Id: If7525e193c245435410b4071aed6d3b566424219 --- ansible/roles/kibana/defaults/main.yml | 14 ++++++++++++++ ansible/roles/kibana/handlers/main.yml | 1 + ansible/roles/kibana/tasks/check-containers.yml | 1 + ...r-healthchecks-for-kibana-4aff69122b158c00.yaml | 6 ++++++ 4 files changed, 22 insertions(+) create mode 100644 releasenotes/notes/implement-docker-healthchecks-for-kibana-4aff69122b158c00.yaml diff --git a/ansible/roles/kibana/defaults/main.yml b/ansible/roles/kibana/defaults/main.yml index 2ae5b9b40a..67c2a69e95 100644 --- a/ansible/roles/kibana/defaults/main.yml +++ b/ansible/roles/kibana/defaults/main.yml @@ -9,6 +9,7 @@ kibana_services: group: "kibana" volumes: "{{ kibana_default_volumes + kibana_extra_volumes }}" dimensions: "{{ kibana_dimensions }}" + healthcheck: "{{ kibana_healthcheck }}" haproxy: kibana: enabled: "{{ enable_kibana }}" @@ -44,6 +45,19 @@ kibana_tag: "{{ openstack_tag }}" kibana_image_full: "{{ kibana_image }}:{{ kibana_tag }}" kibana_dimensions: "{{ default_container_dimensions }}" +kibana_enable_healthchecks: "{{ enable_container_healthchecks }}" +kibana_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +kibana_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +kibana_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +kibana_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ kibana_server_port }}"] +kibana_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +kibana_healthcheck: + interval: "{{ kibana_healthcheck_interval }}" + retries: "{{ kibana_healthcheck_retries }}" + start_period: "{{ kibana_healthcheck_start_period }}" + test: "{% if kibana_enable_healthchecks | bool %}{{ kibana_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ kibana_healthcheck_timeout }}" + kibana_default_volumes: - "{{ node_config_directory }}/kibana/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/kibana/handlers/main.yml b/ansible/roles/kibana/handlers/main.yml index 5a2b7960ba..28b5c9aef7 100644 --- a/ansible/roles/kibana/handlers/main.yml +++ b/ansible/roles/kibana/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/kibana/tasks/check-containers.yml b/ansible/roles/kibana/tasks/check-containers.yml index 0cec20734b..87bafdbb72 100644 --- a/ansible/roles/kibana/tasks/check-containers.yml +++ b/ansible/roles/kibana/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-kibana-4aff69122b158c00.yaml b/releasenotes/notes/implement-docker-healthchecks-for-kibana-4aff69122b158c00.yaml new file mode 100644 index 0000000000..8ca28c53cd --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-kibana-4aff69122b158c00.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for kibana services. + See `blueprint + `__