Skip to content

Commit

Permalink
Reflect configured http proxy in docker (#15248)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj authored Dec 20, 2024
1 parent a8a891c commit e22e643
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/middlewared/middlewared/etc_files/docker/daemon.json.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

def render(service, middleware):
config = middleware.call_sync('docker.config')
http_proxy = middleware.call_sync('network.configuration.config')['httpproxy']
if not config['pool']:
raise FileShouldNotExist()

Expand All @@ -25,6 +26,14 @@ def render(service, middleware):
'storage-driver': 'overlay2',
'fixed-cidr-v6': config['cidr_v6'],
'default-address-pools': config['address_pools'],
**(
{
'proxies': {
'http-proxy': http_proxy,
'https-proxy': http_proxy,
}
} if http_proxy else {}
)
}
isolated = middleware.call_sync('system.advanced.config')['isolated_gpu_pci_ids']
for gpu in filter(lambda x: x not in isolated, get_nvidia_gpus()):
Expand Down
3 changes: 3 additions & 0 deletions src/middlewared/middlewared/plugins/network_/global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ async def do_update(self, data):
{'data': {'httpproxy': new_config['httpproxy']}}
)

if (await self.middleware.call('docker.config'))['pool']:
# Docker needs to be restarted to reflect http proxy changes
service_actions.add(('docker', 'restart'))
# allowing outbound network activity has been changed
if new_config['activity'] != config['activity']:
await self.middleware.call('zettarepl.update_tasks')
Expand Down

0 comments on commit e22e643

Please sign in to comment.