Support configuration of Docker client timeout

Adds support for configuration of the Docker client timeout via
'docker_client_timeout'.

This change also increases the default timeout to 120 seconds, as we
sometimes see timeouts in CI and heavily loaded or underpowered
environments. Increasing 'docker_client_timeout' further may be helpful
in cases where Docker reports 'Read timed out'.

Change-Id: I73745771078cb2c0ebae2b1d87ba2c4c12958d82
Closes-Bug: #1809844
This commit is contained in:
Mark Goddard 2019-11-27 14:52:03 +00:00
parent 692d176cd5
commit 01050dc01f
5 changed files with 23 additions and 1 deletions

View File

@ -96,6 +96,8 @@ docker_namespace: "kolla"
docker_registry_username:
docker_registry_insecure: "{{ 'yes' if docker_registry else 'no' }}"
docker_runtime_directory: ""
# Docker client timeout in seconds.
docker_client_timeout: 120
# Retention settings for Docker logs
docker_log_max_file: "5"
@ -127,6 +129,7 @@ docker_common_options:
restart_policy: "{{ docker_restart_policy }}"
restart_retries: "{{ docker_restart_policy_retry }}"
graceful_timeout: "{{ docker_graceful_timeout }}"
client_timeout: "{{ docker_client_timeout }}"
####################
# Dimensions options

View File

@ -201,6 +201,12 @@ options:
required: False
default: False
type: bool
client_timeout:
description:
- Docker client timeout in seconds
required: False
default: 120
type: int
author: Sam Yaple
'''
@ -252,7 +258,8 @@ class DockerWorker(object):
# tls_config = self.generate_tls()
options = {
'version': self.params.get('api_version')
'version': self.params.get('api_version'),
'timeout': self.params.get('client_timeout'),
}
self.dc = get_docker_client()(**options)
@ -957,6 +964,7 @@ def generate_module():
volumes_from=dict(required=False, type='list'),
dimensions=dict(required=False, type='dict', default=dict()),
tty=dict(required=False, type='bool', default=False),
client_timeout=dict(required=False, type='int', default=120),
)
required_if = [
['action', 'pull_image', ['image']],

View File

@ -57,6 +57,8 @@
#docker_registry_insecure: "yes"
#docker_registry_username: "sam"
#docker_registry_password: "correcthorsebatterystaple"
# Docker client timeout in seconds.
#docker_client_timeout: 120
#docker_configure_for_zun: "no"

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixes an issue with Docker client timeouts where Docker reports 'Read
timed out'. The client timeout may be configured via
``docker_client_timeout``. The default timeout has been increased to 120
seconds. See `bug
<https://bugs.launchpad.net/kolla-ansible/+bug/1809844>`__ for details.

View File

@ -98,6 +98,7 @@ class ModuleArgsTest(base.BaseTestCase):
volumes_from=dict(required=False, type='list'),
dimensions=dict(required=False, type='dict', default=dict()),
tty=dict(required=False, type='bool', default=False),
client_timeout=dict(required=False, type='int', default=120),
)
required_if = [
['action', 'pull_image', ['image']],