Add 'hostname' and 'extra_hosts' to podman

We are starting a WIP to replace docker-compose/docker with paunch/podman [1]
but to do so we need either ne able to resolve the service name or the
option here wich just adding extra_hosts and hostname docker-compose
configuration so we can resolve the differnt services of zuul
quickstart between them.

[1] https://review.rdoproject.org/r/#/c/20488/

Change-Id: I36f014f5e729010b44876d8f5994629477bac4e8
This commit is contained in:
Quique Llorente 2019-04-29 11:17:15 +02:00
parent 95ad4705f1
commit e948fdce90
3 changed files with 18 additions and 1 deletions

View File

@ -76,6 +76,10 @@ class PodmanBuilder(base.BaseBuilder):
self.string_arg(cconfig, cmd, 'mem_swappiness', '--memory-swappiness')
self.string_arg(cconfig, cmd, 'security_opt', '--security-opt')
self.string_arg(cconfig, cmd, 'stop_signal', '--stop-signal')
self.string_arg(cconfig, cmd, 'hostname', '--hostname')
for extra_host in cconfig.get('extra_hosts', []):
if extra_host:
cmd.append('--add-host=%s' % extra_host)
self.string_arg(cconfig, cmd,
'stop_grace_period', '--stop-timeout',

View File

@ -36,7 +36,12 @@ class TestPodmanBuilder(base.TestBaseBuilder):
'mem_swappiness': '60',
'security_opt': 'label:disable',
'cap_add': ['SYS_ADMIN', 'SETUID'],
'cap_drop': ['NET_RAW']
'cap_drop': ['NET_RAW'],
'hostname': 'foohostname',
'extra_hosts': [
'foohost:127.0.0.1',
'barhost:127.0.0.2'
]
}
}
builder = podman.PodmanBuilder('foo', config, None)
@ -55,6 +60,9 @@ class TestPodmanBuilder(base.TestBaseBuilder):
'--memory-swap=1G',
'--memory-swappiness=60',
'--security-opt=label:disable',
'--hostname=foohostname',
'--add-host=foohost:127.0.0.1',
'--add-host=barhost:127.0.0.2',
'--cap-add=SYS_ADMIN', '--cap-add=SETUID', '--cap-drop=NET_RAW',
'centos:7'],
cmd

View File

@ -0,0 +1,5 @@
---
features:
- |
paunch learns 'hostname' wich maps to podman run --hostname and
'extra_hosts' mapping to podman run --add-host.