[openstack-dev] [tripleo] Implementing container healthchecks

Lars Kellogg-Stedman lars at redhat.com
Thu Jul 13 14:54:56 UTC 2017


We [1] have started work on implementing support for
https://blueprints.launchpad.net/tripleo/+spec/container-healthchecks in
tripleo-common.  I would like to describe the approach we're taking in the
short term, as well as explore some ideas for longer-term implementations.

## Our current approach

We will be implementing service health checks in the 'healthcheck'
directory of tripleo-common.  Once the checks are merged and available in
distribution packages, we will then
modify container-images/tripleo_kolla_template_overrides.j2 to activate
specific checks for containerized services.  A typical modification would
look something like:

  {% block nova_api_footer %}
  RUN install -D -m 755 /usr/share/tripleo-common/healthcheck/nova-api
/openstack/healthcheck
  HEALTHCHECK CMD /openstack/healthcheck
  {% endblock %}

That copies the specific healthcheck command to /openstack/healthcheck, and
then configures docker to run that check using the HEALTHCHECK directive.

This approach has the advantage of keeping all the development work within
tripleo-common for now.

If you are unfamiliar with Docker's HEALTHCHECK feature:

Docker will run this command periodically inside the container, and will
expose the status reported by the script (0 - healthy, 1 - unhealthy) via
the Docker API.  This is visible in the output of 'docker ps', for example:

  $ docker ps
  ... STATUS ...
      Up 8 minutes (healthy)

Details at:
https://docs.docker.com/engine/reference/builder/#healthchecDetails at:

## Looking to the future

Our initial thought was that moving forward, these checks could be
implemented through the Kolla project.  However, Martin André suggested
(correctly) that these checks would also be of interest outside of Kolla.
The thought right now is that at some point in the future, we would split
the checks out into a separate project to make them more generally
consumable.

## Reviews

You can see the proposed changes here:

- https://review.openstack.org/#/q/topic:bp/container-healthchecks+is:open

Specifically, the initial framework is provided in:

- https://review.openstack.org/#/c/483081/

And an initial set of checks is in:

- https://review.openstack.org/#/c/483104/

Please feel to review and comment. While we are reasonably happy with the
solution proposed in this email, we are open to improvements.  Thanks for
your input!

[1] Initially, Dan Prince, Ian Main, Martin Mágr, Lars Kellogg-Stedman

-- 
Lars Kellogg-Stedman <lars at redhat.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170713/2f151ebe/attachment.html>


More information about the OpenStack-dev mailing list