From 48cd90a8d597021d61c75db872cdde24a10e569c Mon Sep 17 00:00:00 2001 From: wuchunyang Date: Mon, 15 Mar 2021 22:24:36 +0800 Subject: [PATCH] Use Docker healthchecks for ceilometer services This change enables the use of Docker healthchecks for ceilometer services. Implements: blueprint container-health-check Change-Id: Ieed654e694e9a0a63fd3f0906395bc7bf7c07552 --- ansible/roles/ceilometer/defaults/main.yml | 56 +++++++++++++++++++ ansible/roles/ceilometer/handlers/main.yml | 4 ++ .../ceilometer/tasks/check-containers.yml | 1 + ...hecks-for-ceilometer-e68dfc1dc1ce347e.yaml | 6 ++ 4 files changed, 67 insertions(+) create mode 100644 releasenotes/notes/implement-docker-healthchecks-for-ceilometer-e68dfc1dc1ce347e.yaml diff --git a/ansible/roles/ceilometer/defaults/main.yml b/ansible/roles/ceilometer/defaults/main.yml index 22569fee34..7fd4b4b546 100644 --- a/ansible/roles/ceilometer/defaults/main.yml +++ b/ansible/roles/ceilometer/defaults/main.yml @@ -9,6 +9,7 @@ ceilometer_services: image: "{{ ceilometer_notification_image_full }}" volumes: "{{ ceilometer_notification_default_volumes + ceilometer_notification_extra_volumes }}" dimensions: "{{ ceilometer_notification_dimensions }}" + healthcheck: "{{ ceilometer_notification_healthcheck }}" ceilometer-central: container_name: ceilometer_central group: ceilometer-central @@ -16,6 +17,7 @@ ceilometer_services: image: "{{ ceilometer_central_image_full }}" volumes: "{{ ceilometer_central_default_volumes + ceilometer_central_extra_volumes }}" dimensions: "{{ ceilometer_central_dimensions }}" + healthcheck: "{{ ceilometer_central_healthcheck }}" ceilometer-compute: container_name: ceilometer_compute group: ceilometer-compute @@ -24,6 +26,7 @@ ceilometer_services: image: "{{ ceilometer_compute_image_full }}" volumes: "{{ ceilometer_compute_default_volumes + ceilometer_compute_extra_volumes }}" dimensions: "{{ ceilometer_compute_dimensions }}" + healthcheck: "{{ ceilometer_compute_healthcheck }}" ceilometer-ipmi: container_name: ceilometer_ipmi group: ceilometer-ipmi @@ -31,6 +34,7 @@ ceilometer_services: image: "{{ ceilometer_ipmi_image_full }}" volumes: "{{ ceilometer_ipmi_default_volumes + ceilometer_ipmi_extra_volumes }}" dimensions: "{{ ceilometer_ipmi_dimensions }}" + healthcheck: "{{ ceilometer_ipmi_healthcheck }}" #################### @@ -60,6 +64,58 @@ ceilometer_central_dimensions: "{{ default_container_dimensions }}" ceilometer_compute_dimensions: "{{ default_container_dimensions }}" ceilometer_ipmi_dimensions: "{{ default_container_dimensions }}" +ceilometer_notification_enable_healthchecks: "{{ enable_container_healthchecks }}" +ceilometer_notification_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +ceilometer_notification_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +ceilometer_notification_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +ceilometer_notification_healthcheck_test: ["CMD-SHELL", "healthcheck_port ceilometer-agent-notification {{ om_rpc_port }}"] +ceilometer_notification_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +ceilometer_notification_healthcheck: + interval: "{{ ceilometer_notification_healthcheck_interval }}" + retries: "{{ ceilometer_notification_healthcheck_retries }}" + start_period: "{{ ceilometer_notification_healthcheck_start_period }}" + test: "{% if ceilometer_notification_enable_healthchecks | bool %}{{ ceilometer_notification_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ ceilometer_notification_healthcheck_timeout }}" + +ceilometer_central_enable_healthchecks: "{{ enable_container_healthchecks }}" +ceilometer_central_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +ceilometer_central_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +ceilometer_central_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +ceilometer_central_healthcheck_test: ["CMD-SHELL", "healthcheck_port ceilometer-polling {{ om_rpc_port }}"] +ceilometer_central_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +ceilometer_central_healthcheck: + interval: "{{ ceilometer_central_healthcheck_interval }}" + retries: "{{ ceilometer_central_healthcheck_retries }}" + start_period: "{{ ceilometer_central_healthcheck_start_period }}" + test: "{% if ceilometer_central_enable_healthchecks | bool %}{{ ceilometer_central_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ ceilometer_central_healthcheck_timeout }}" + +ceilometer_compute_enable_healthchecks: "{{ enable_container_healthchecks }}" +ceilometer_compute_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +ceilometer_compute_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +ceilometer_compute_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +ceilometer_compute_healthcheck_test: ["CMD-SHELL", "healthcheck_port ceilometer-polling {{ om_rpc_port }}"] +ceilometer_compute_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +ceilometer_compute_healthcheck: + interval: "{{ ceilometer_compute_healthcheck_interval }}" + retries: "{{ ceilometer_compute_healthcheck_retries }}" + start_period: "{{ ceilometer_compute_healthcheck_start_period }}" + test: "{% if ceilometer_compute_enable_healthchecks | bool %}{{ ceilometer_compute_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ ceilometer_compute_healthcheck_timeout }}" + +ceilometer_ipmi_enable_healthchecks: "{{ enable_container_healthchecks }}" +ceilometer_ipmi_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +ceilometer_ipmi_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +ceilometer_ipmi_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +ceilometer_ipmi_healthcheck_test: ["CMD-SHELL", "healthcheck_port ceilometer-polling {{ om_rpc_port }}"] +ceilometer_ipmi_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +ceilometer_ipmi_healthcheck: + interval: "{{ ceilometer_ipmi_healthcheck_interval }}" + retries: "{{ ceilometer_ipmi_healthcheck_retries }}" + start_period: "{{ ceilometer_ipmi_healthcheck_start_period }}" + test: "{% if ceilometer_ipmi_enable_healthchecks | bool %}{{ ceilometer_ipmi_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ ceilometer_ipmi_healthcheck_timeout }}" + ceilometer_notification_default_volumes: - "{{ node_config_directory }}/ceilometer-notification/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/ceilometer/handlers/main.yml b/ansible/roles/ceilometer/handlers/main.yml index 87a541148c..b6d26c05ab 100644 --- a/ansible/roles/ceilometer/handlers/main.yml +++ b/ansible/roles/ceilometer/handlers/main.yml @@ -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" @@ -42,6 +44,7 @@ privileged: "{{ service.privileged | default(False) }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" @@ -57,5 +60,6 @@ image: "{{ service.image }}" volumes: "{{ service.volumes }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" diff --git a/ansible/roles/ceilometer/tasks/check-containers.yml b/ansible/roles/ceilometer/tasks/check-containers.yml index ef6d6573d6..752a87a2b1 100644 --- a/ansible/roles/ceilometer/tasks/check-containers.yml +++ b/ansible/roles/ceilometer/tasks/check-containers.yml @@ -9,6 +9,7 @@ privileged: "{{ item.value.privileged | default(False) }}" volumes: "{{ item.value.volumes | reject('equalto', '')|list }}" 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-ceilometer-e68dfc1dc1ce347e.yaml b/releasenotes/notes/implement-docker-healthchecks-for-ceilometer-e68dfc1dc1ce347e.yaml new file mode 100644 index 0000000000..d76dfb7d79 --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-ceilometer-e68dfc1dc1ce347e.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for ceilometer services. + See `blueprint + `__