mirror of
https://github.com/clearml/clearml-agent
synced 2025-06-25 17:45:51 +00:00
Fix k8s support to allow a specific network for the docker (do not use the parent daemon network definition)
This commit is contained in:
parent
e3d0680d39
commit
f2d2d702de
@ -1898,13 +1898,14 @@ class Worker(ServiceCommandSection):
|
|||||||
|
|
||||||
# check if running inside a kubernetes
|
# check if running inside a kubernetes
|
||||||
if os.environ.get('KUBERNETES_SERVICE_HOST') and os.environ.get('KUBERNETES_PORT'):
|
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
|
||||||
try:
|
if not any(a.strip().startswith('--network') for a in base_cmd):
|
||||||
network_mode = get_bash_output(
|
try:
|
||||||
'docker inspect --format=\'{{.HostConfig.NetworkMode}}\' $(basename $(cat /proc/1/cpuset))')
|
network_mode = get_bash_output(
|
||||||
base_cmd += ['--network', network_mode]
|
'docker inspect --format=\'{{.HostConfig.NetworkMode}}\' $(basename $(cat /proc/1/cpuset))')
|
||||||
except:
|
base_cmd += ['--network', network_mode]
|
||||||
pass
|
except:
|
||||||
|
pass
|
||||||
base_cmd += ['-e', 'NVIDIA_VISIBLE_DEVICES={}'.format(dockers_nvidia_visible_devices)]
|
base_cmd += ['-e', 'NVIDIA_VISIBLE_DEVICES={}'.format(dockers_nvidia_visible_devices)]
|
||||||
|
|
||||||
# check if we need to map host folders
|
# check if we need to map host folders
|
||||||
|
Loading…
Reference in New Issue
Block a user