Skip to content

Commit

Permalink
Merge pull request #7217 from aiordache/compose_v3.8_schema_support
Browse files Browse the repository at this point in the history
Add v3.8 schema support
  • Loading branch information
ulyssessouza authored Feb 10, 2020
2 parents 13bacba + 79fe7ca commit bb93a18
Show file tree
Hide file tree
Showing 5 changed files with 1,679 additions and 219 deletions.
9 changes: 7 additions & 2 deletions compose/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,12 +990,17 @@ def translate_deploy_keys_to_container_config(service_dict):

deploy_dict = service_dict['deploy']
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 '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:
service_dict['restart'] = {
Expand Down
Loading

0 comments on commit bb93a18

Please sign in to comment.