Add health check support to paunch.

Add support for health-cmd and health-interval to support health
checks for containers.

Change-Id: Ifcf900aac2c21fab9ad43d1ad4b84c2b56babd12
This commit is contained in:
Ian Main 2017-06-27 17:57:29 -04:00
parent c8e22e55af
commit de7eac0012
2 changed files with 18 additions and 0 deletions

View File

@ -141,6 +141,16 @@ class ComposeV1Builder(object):
cmd.append('--ipc=%s' % cconfig['ipc'])
if 'pid' in cconfig:
cmd.append('--pid=%s' % cconfig['pid'])
if 'healthcheck' in cconfig:
hconfig = cconfig['healthcheck']
if 'test' in hconfig:
cmd.append('--health-cmd=%s' % hconfig['test'])
if 'interval' in hconfig:
cmd.append('--health-interval=%s' % hconfig['interval'])
if 'timeout' in hconfig:
cmd.append('--health-timeout=%s' % hconfig['timeout'])
if 'retries' in hconfig:
cmd.append('--health-retries=%s' % hconfig['retries'])
if 'privileged' in cconfig:
cmd.append('--privileged=%s' % str(cconfig['privileged']).lower())
if 'restart' in cconfig:

View File

@ -317,6 +317,12 @@ three-12345678 three''', '', 0),
'ipc': 'host',
'pid': 'container:bar',
'restart': 'always',
'healthcheck': {
'test': '/bin/true',
'interval': '30s',
'timeout': '10s',
'retries': 3
},
'env_file': '/tmp/foo.env',
}
}
@ -328,6 +334,8 @@ three-12345678 three''', '', 0),
['docker', 'run', '--name', 'one',
'--detach=true', '--env-file=/tmp/foo.env',
'--net=host', '--ipc=host', '--pid=container:bar',
'--health-cmd=/bin/true', '--health-interval=30s',
'--health-timeout=10s', '--health-retries=3',
'--privileged=true', '--restart=always', '--user=bar',
'centos:7'],
cmd