healthchecks: start to implement container healthchecks

This is the first in a series of patches that will implement
healthchecks for containerized services, conforming to the Docker
HEALTHCHECK api and to the container-healthchecks blueprint.  This
commit includes an example healtcheck (for heat-api), and modifies the
pep8 check to error out on duplicate jinja blocks in
container-images/tripleo_kolla_template_overrides.j2, since we will be
adding or modifying the _footer block for each service.

Change-Id: Id9fc19dd386e395317093d1723b836ae2807fdf0
Implements: blueprint container-healthchecks
Co-authored-by: Dan Prince <dprince@redhat.com>
Co-authored-by: Ian Main <imain@redhat.com>
This commit is contained in:
Lars Kellogg-Stedman 2017-07-12 15:40:54 -04:00
parent db171f27b7
commit 80fe68beb8
5 changed files with 30 additions and 1 deletions

View File

@ -8,7 +8,7 @@
# This installs the puppet dependency in the base container and includes helper scripts
# Rsync is required for docker-puppet.py to move the generated config to /var/lib/config-data
# Cron is required by multiple services
{% set base_centos_binary_packages_append = ['openstack-tripleo-common-container-base', 'rsync', 'cronie'] %}
{% set base_centos_binary_packages_append = ['openstack-tripleo-common-container-base', 'rsync', 'cronie', 'crudini'] %}
{% set nova_scheduler_packages_append = ['openstack-tripleo-common'] %}
# Required for mistral-db-populate to load tripleo custom actions on

5
healthcheck/heat-api Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
bind_host=$(crudini --get /etc/heat/heat.conf heat_api bind_host 2> /dev/null || echo 127.0.0.1)
bind_port=$(crudini --get /etc/heat/heat.conf heat_api bind_port 2> /dev/null || echo 8004)
curl --fail http://${bind_host}:${bind_port}/ || exit 1

View File

@ -39,6 +39,7 @@ data_files =
share/tripleo-common/container-images = container-images/*
share/tripleo-common/image-yaml = image-yaml/*
share/tripleo-common/workbooks = workbooks/*
share/tripleo-common/healthcheck = healthcheck/*
[build_sphinx]
source-dir = doc/source

View File

@ -0,0 +1,21 @@
#!/bin/sh
myname=${0##*/}
path=container-images/tripleo_kolla_template_overrides.j2
grep '{% block' $path |
sort |
uniq -c |
awk -v myname=$myname '
$1 == 2 {
printf "%s: found duplicate block for %s\n", myname, $4
retval=1
}
END {exit retval}
'
if [ $? -ne 0 ]; then
echo "$myname: duplicate jinja block declarations found in $path" >&2
exit 1
fi

View File

@ -12,9 +12,11 @@ setenv =
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}'
whitelist_externals = bash
[testenv:pep8]
commands = flake8
bash -c tools/check_duplicate_jinja_blocks.sh
[testenv:venv]
commands = {posargs}