Fix k8s support to allow a specific network for the docker (do not use the parent daemon network definition)

This commit is contained in:
allegroai 2020-03-09 12:38:32 +02:00
parent e3d0680d39
commit f2d2d702de

View File

@ -1898,7 +1898,8 @@ class Worker(ServiceCommandSection):
# check if running inside a kubernetes
if os.environ.get('KUBERNETES_SERVICE_HOST') and os.environ.get('KUBERNETES_PORT'):
# map network to sibling docker
# map network to sibling docker, unless we have other network argument
if not any(a.strip().startswith('--network') for a in base_cmd):
try:
network_mode = get_bash_output(
'docker inspect --format=\'{{.HostConfig.NetworkMode}}\' $(basename $(cat /proc/1/cpuset))')