diff --git a/ansible/roles/tacker/defaults/main.yml b/ansible/roles/tacker/defaults/main.yml index 71dd2a0b3b..8df763f397 100644 --- a/ansible/roles/tacker/defaults/main.yml +++ b/ansible/roles/tacker/defaults/main.yml @@ -10,6 +10,7 @@ tacker_services: image: "{{ tacker_server_image_full }}" volumes: "{{ tacker_server_default_volumes + tacker_server_extra_volumes }}" dimensions: "{{ tacker_server_dimensions }}" + healthcheck: "{{ tacker_server_healthcheck }}" haproxy: tacker_server: enabled: "{{ enable_tacker }}" @@ -31,6 +32,7 @@ tacker_services: image: "{{ tacker_conductor_image_full }}" volumes: "{{ tacker_conductor_default_volumes + tacker_conductor_extra_volumes }}" dimensions: "{{ tacker_conductor_dimensions }}" + healthcheck: "{{ tacker_conductor_healthcheck }}" #################### # Database @@ -56,6 +58,32 @@ tacker_conductor_image_full: "{{ tacker_conductor_image }}:{{ tacker_conductor_t tacker_server_dimensions: "{{ default_container_dimensions }}" tacker_conductor_dimensions: "{{ default_container_dimensions }}" +tacker_server_enable_healthchecks: "{{ enable_container_healthchecks }}" +tacker_server_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +tacker_server_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +tacker_server_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +tacker_server_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ tacker_server_port }}"] +tacker_server_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +tacker_server_healthcheck: + interval: "{{ tacker_server_healthcheck_interval }}" + retries: "{{ tacker_server_healthcheck_retries }}" + start_period: "{{ tacker_server_healthcheck_start_period }}" + test: "{% if tacker_server_enable_healthchecks | bool %}{{ tacker_server_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ tacker_server_healthcheck_timeout }}" + +tacker_conductor_enable_healthchecks: "{{ enable_container_healthchecks }}" +tacker_conductor_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +tacker_conductor_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +tacker_conductor_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +tacker_conductor_healthcheck_test: ["CMD-SHELL", "healthcheck_port tacker-conductor {{ om_rpc_port }}"] +tacker_conductor_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +tacker_conductor_healthcheck: + interval: "{{ tacker_conductor_healthcheck_interval }}" + retries: "{{ tacker_conductor_healthcheck_retries }}" + start_period: "{{ tacker_conductor_healthcheck_start_period }}" + test: "{% if tacker_conductor_enable_healthchecks | bool %}{{ tacker_conductor_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ tacker_conductor_healthcheck_timeout }}" + tacker_server_default_volumes: - "{{ node_config_directory }}/tacker-server/:{{ container_config_directory }}/:ro" - "{{ kolla_dev_repos_directory ~ '/tacker/tacker:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/tacker' if tacker_dev_mode | bool else '' }}" diff --git a/ansible/roles/tacker/handlers/main.yml b/ansible/roles/tacker/handlers/main.yml index 9808902c84..2b358e77d2 100644 --- a/ansible/roles/tacker/handlers/main.yml +++ b/ansible/roles/tacker/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,5 +27,6 @@ image: "{{ service.image }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" diff --git a/ansible/roles/tacker/tasks/check-containers.yml b/ansible/roles/tacker/tasks/check-containers.yml index e3313bd9b2..2acf0e563d 100644 --- a/ansible/roles/tacker/tasks/check-containers.yml +++ b/ansible/roles/tacker/tasks/check-containers.yml @@ -7,6 +7,7 @@ image: "{{ item.value.image }}" volumes: "{{ item.value.volumes|reject('equalto', '')|list }}" dimensions: "{{ item.value.dimensions }}" + healthcheck: "{{ item.value.healthcheck | default(omit) }}" when: - item.value.host_in_groups | bool - item.value.enabled | bool diff --git a/releasenotes/notes/implement-docker-healthchecks-for-tacker-aa8a2b2180d57a90.yaml b/releasenotes/notes/implement-docker-healthchecks-for-tacker-aa8a2b2180d57a90.yaml new file mode 100644 index 0000000000..11954ac132 --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-tacker-aa8a2b2180d57a90.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for tacker services. + See `blueprint + `__