diff --git a/ansible/roles/memcached/defaults/main.yml b/ansible/roles/memcached/defaults/main.yml index 4aa4858b08926d03d9638f6744014f7c3b860b5c..78f18cf7351a749b0acbcf38d35ea5840531dc79 100644 --- a/ansible/roles/memcached/defaults/main.yml +++ b/ansible/roles/memcached/defaults/main.yml @@ -9,6 +9,7 @@ memcached_services: group: "memcached" volumes: "{{ memcached_default_volumes + memcached_extra_volumes }}" dimensions: "{{ memcached_dimensions }}" + healthcheck: "{{ memcached_healthcheck }}" haproxy: memcached: enabled: "{{ enable_memcached|bool and enable_haproxy_memcached|bool }}" @@ -36,6 +37,19 @@ memcached_tag: "{{ openstack_tag }}" memcached_image_full: "{{ memcached_image }}:{{ memcached_tag }}" memcached_dimensions: "{{ default_container_dimensions }}" +memcached_enable_healthchecks: "{{ enable_container_healthchecks }}" +memcached_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +memcached_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +memcached_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +memcached_healthcheck_test: ["CMD-SHELL", "healthcheck_listen memcached {{ memcached_port }}"] +memcached_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +memcached_healthcheck: + interval: "{{ memcached_healthcheck_interval }}" + retries: "{{ memcached_healthcheck_retries }}" + start_period: "{{ memcached_healthcheck_start_period }}" + test: "{% if memcached_enable_healthchecks | bool %}{{ memcached_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ memcached_healthcheck_timeout }}" + memcached_default_volumes: - "{{ node_config_directory }}/memcached/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/memcached/handlers/main.yml b/ansible/roles/memcached/handlers/main.yml index b76466d62004645fc93293aeeaeebd12efae41be..4bdfe525e086d661f2b6b1e57fc8366a87353e3a 100644 --- a/ansible/roles/memcached/handlers/main.yml +++ b/ansible/roles/memcached/handlers/main.yml @@ -10,5 +10,6 @@ name: "{{ service.container_name }}" volumes: "{{ service.volumes }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" diff --git a/ansible/roles/memcached/tasks/check-containers.yml b/ansible/roles/memcached/tasks/check-containers.yml index da8731757362f22180594377f408167af6e54c89..d74e92991c39c910907f96ea68ee82bfc2e2b862 100644 --- a/ansible/roles/memcached/tasks/check-containers.yml +++ b/ansible/roles/memcached/tasks/check-containers.yml @@ -10,6 +10,7 @@ image: "{{ service.image }}" volumes: "{{ service.volumes }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - inventory_hostname in groups[service.group] - service.enabled | bool diff --git a/releasenotes/notes/implement-docker-healthchecks-for-memcached-807b9036c3c92596.yaml b/releasenotes/notes/implement-docker-healthchecks-for-memcached-807b9036c3c92596.yaml new file mode 100644 index 0000000000000000000000000000000000000000..858b81185aa2b87f6e375e5f405706e1038d44bc --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-memcached-807b9036c3c92596.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for memcached services. + See `blueprint + <https://blueprints.launchpad.net/kolla-ansible/+spec/container-health-check>`__