diff --git a/ansible/roles/kuryr/defaults/main.yml b/ansible/roles/kuryr/defaults/main.yml index a9ef18fe1a..28e8c97561 100644 --- a/ansible/roles/kuryr/defaults/main.yml +++ b/ansible/roles/kuryr/defaults/main.yml @@ -19,6 +19,7 @@ kuryr_services: - NET_ADMIN volumes: "{{ kuryr_default_volumes + kuryr_extra_volumes }}" dimensions: "{{ kuryr_dimensions }}" + healthcheck: "{{ kuryr_healthcheck }}" #################### @@ -29,6 +30,19 @@ kuryr_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_na kuryr_tag: "{{ openstack_tag }}" kuryr_image_full: "{{ kuryr_image }}:{{ kuryr_tag }}" +kuryr_enable_healthchecks: "{{ enable_container_healthchecks }}" +kuryr_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +kuryr_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +kuryr_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +kuryr_healthcheck_test: ["CMD-SHELL", "healthcheck_listen kuryr-server {{ kuryr_port }}"] +kuryr_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +kuryr_healthcheck: + interval: "{{ kuryr_healthcheck_interval }}" + retries: "{{ kuryr_healthcheck_retries }}" + start_period: "{{ kuryr_healthcheck_start_period }}" + test: "{% if kuryr_enable_healthchecks | bool %}{{ kuryr_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ kuryr_healthcheck_timeout }}" + kuryr_default_volumes: - "{{ node_config_directory }}/kuryr/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/kuryr/handlers/main.yml b/ansible/roles/kuryr/handlers/main.yml index 76d79ab28b..3b7dbac15d 100644 --- a/ansible/roles/kuryr/handlers/main.yml +++ b/ansible/roles/kuryr/handlers/main.yml @@ -13,5 +13,6 @@ cap_add: "{{ service.cap_add }}" volumes: "{{ service.volumes }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" diff --git a/ansible/roles/kuryr/tasks/check-containers.yml b/ansible/roles/kuryr/tasks/check-containers.yml index 0472c4dd6c..e89eec8787 100644 --- a/ansible/roles/kuryr/tasks/check-containers.yml +++ b/ansible/roles/kuryr/tasks/check-containers.yml @@ -10,6 +10,7 @@ cap_add: "{{ item.value.cap_add }}" 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-kuryr-9cc3d0480e9fe505.yaml b/releasenotes/notes/implement-docker-healthchecks-for-kuryr-9cc3d0480e9fe505.yaml new file mode 100644 index 0000000000..497fc90a95 --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-kuryr-9cc3d0480e9fe505.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for zun services. + See `blueprint + `__