mirror of https://github.com/docker/compose.git
Merge pull request #7217 from aiordache/compose_v3.8_schema_support
Add v3.8 schema support
This commit is contained in:
commit
bb93a18500
|
@ -990,12 +990,17 @@ def translate_deploy_keys_to_container_config(service_dict):
|
||||||
|
|
||||||
deploy_dict = service_dict['deploy']
|
deploy_dict = service_dict['deploy']
|
||||||
ignored_keys = [
|
ignored_keys = [
|
||||||
k for k in ['endpoint_mode', 'labels', 'update_config', 'rollback_config', 'placement']
|
k for k in ['endpoint_mode', 'labels', 'update_config', 'rollback_config']
|
||||||
if k in deploy_dict
|
if k in deploy_dict
|
||||||
]
|
]
|
||||||
|
|
||||||
if 'replicas' in deploy_dict and deploy_dict.get('mode', 'replicated') == 'replicated':
|
if 'replicas' in deploy_dict and deploy_dict.get('mode', 'replicated') == 'replicated':
|
||||||
service_dict['scale'] = deploy_dict['replicas']
|
scale = deploy_dict.get('replicas', 1)
|
||||||
|
max_replicas = deploy_dict.get('placement', {}).get('max_replicas_per_node', scale)
|
||||||
|
service_dict['scale'] = min(scale, max_replicas)
|
||||||
|
if max_replicas < scale:
|
||||||
|
log.warning("Scale is limited to {} ('max_replicas_per_node' field).".format(
|
||||||
|
max_replicas))
|
||||||
|
|
||||||
if 'restart_policy' in deploy_dict:
|
if 'restart_policy' in deploy_dict:
|
||||||
service_dict['restart'] = {
|
service_dict['restart'] = {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -41,7 +41,10 @@ COMPOSEFILE_V3_4 = ComposeVersion('3.4')
|
||||||
COMPOSEFILE_V3_5 = ComposeVersion('3.5')
|
COMPOSEFILE_V3_5 = ComposeVersion('3.5')
|
||||||
COMPOSEFILE_V3_6 = ComposeVersion('3.6')
|
COMPOSEFILE_V3_6 = ComposeVersion('3.6')
|
||||||
COMPOSEFILE_V3_7 = ComposeVersion('3.7')
|
COMPOSEFILE_V3_7 = ComposeVersion('3.7')
|
||||||
|
COMPOSEFILE_V3_8 = ComposeVersion('3.8')
|
||||||
|
|
||||||
|
# minimum DOCKER ENGINE API version needed to support
|
||||||
|
# features for each compose schema version
|
||||||
API_VERSIONS = {
|
API_VERSIONS = {
|
||||||
COMPOSEFILE_V1: '1.21',
|
COMPOSEFILE_V1: '1.21',
|
||||||
COMPOSEFILE_V2_0: '1.22',
|
COMPOSEFILE_V2_0: '1.22',
|
||||||
|
@ -57,6 +60,7 @@ API_VERSIONS = {
|
||||||
COMPOSEFILE_V3_5: '1.30',
|
COMPOSEFILE_V3_5: '1.30',
|
||||||
COMPOSEFILE_V3_6: '1.36',
|
COMPOSEFILE_V3_6: '1.36',
|
||||||
COMPOSEFILE_V3_7: '1.38',
|
COMPOSEFILE_V3_7: '1.38',
|
||||||
|
COMPOSEFILE_V3_8: '1.38',
|
||||||
}
|
}
|
||||||
|
|
||||||
API_VERSION_TO_ENGINE_VERSION = {
|
API_VERSION_TO_ENGINE_VERSION = {
|
||||||
|
@ -74,4 +78,5 @@ API_VERSION_TO_ENGINE_VERSION = {
|
||||||
API_VERSIONS[COMPOSEFILE_V3_5]: '17.06.0',
|
API_VERSIONS[COMPOSEFILE_V3_5]: '17.06.0',
|
||||||
API_VERSIONS[COMPOSEFILE_V3_6]: '18.02.0',
|
API_VERSIONS[COMPOSEFILE_V3_6]: '18.02.0',
|
||||||
API_VERSIONS[COMPOSEFILE_V3_7]: '18.06.0',
|
API_VERSIONS[COMPOSEFILE_V3_7]: '18.06.0',
|
||||||
|
API_VERSIONS[COMPOSEFILE_V3_8]: '18.06.0',
|
||||||
}
|
}
|
||||||
|
|
|
@ -3637,7 +3637,6 @@ class InterpolationTest(unittest.TestCase):
|
||||||
assert 'labels' in warn_message
|
assert 'labels' in warn_message
|
||||||
assert 'endpoint_mode' in warn_message
|
assert 'endpoint_mode' in warn_message
|
||||||
assert 'update_config' in warn_message
|
assert 'update_config' in warn_message
|
||||||
assert 'placement' in warn_message
|
|
||||||
assert 'resources.reservations.cpus' in warn_message
|
assert 'resources.reservations.cpus' in warn_message
|
||||||
assert 'restart_policy.delay' in warn_message
|
assert 'restart_policy.delay' in warn_message
|
||||||
assert 'restart_policy.window' in warn_message
|
assert 'restart_policy.window' in warn_message
|
||||||
|
|
Loading…
Reference in New Issue