Update schema and fix memory limit parsing

Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
aiordache 2020-08-17 18:58:12 +02:00 committed by Ulysses Souza
parent d773719060
commit 2b4d409ac3
5 changed files with 11 additions and 8 deletions

View File

@ -258,7 +258,7 @@
"patternProperties": {"^x-": {}}
},
"mac_address": {"type": "string"},
"mem_limit": {"type": ["number", "string"]},
"mem_limit": {"type": "string"},
"mem_reservation": {"type": ["string", "integer"]},
"mem_swappiness": {"type": "integer"},
"memswap_limit": {"type": ["number", "string"]},
@ -503,7 +503,7 @@
"limits": {
"type": "object",
"properties": {
"cpus": {"type": "string"},
"cpus": {"type": "number", "minimum": 0},
"memory": {"type": "string"}
},
"additionalProperties": false,
@ -512,7 +512,7 @@
"reservations": {
"type": "object",
"properties": {
"cpus": {"type": "string"},
"cpus": {"type": "number", "minimum": 0},
"memory": {"type": "string"},
"generic_resources": {"$ref": "#/definitions/generic_resources"}
},
@ -633,6 +633,7 @@
"patternProperties": {"^x-": {}}
},
"internal": {"type": "boolean"},
"enable_ipv6": {"type": "boolean"},
"attachable": {"type": "boolean"},
"labels": {"$ref": "#/definitions/list_or_dict"}
},

View File

@ -241,6 +241,7 @@ class ConversionMap:
service_path('healthcheck', 'disable'): to_boolean,
service_path('deploy', 'labels', PATH_JOKER): to_str,
service_path('deploy', 'replicas'): to_int,
service_path('deploy', 'resources', 'limits', "cpus"): to_float,
service_path('deploy', 'update_config', 'parallelism'): to_int,
service_path('deploy', 'update_config', 'max_failure_ratio'): to_float,
service_path('deploy', 'rollback_config', 'parallelism'): to_int,

View File

@ -4,10 +4,11 @@ certifi==2020.6.20
chardet==3.0.4
colorama==0.4.3; sys_platform == 'win32'
distro==1.5.0
docker==4.3.0
docker-pycreds==0.4.0
dockerpty==0.4.1
docopt==0.6.2
# temporary fix for the mem_limit float parsing
git+git://github.com/docker/docker-py@2c522fb362247a692c0493f0b47a33988eb2f3e3#egg=docker
idna==2.10
ipaddress==1.0.23
jsonschema==3.2.0

View File

@ -525,11 +525,11 @@ services:
},
'resources': {
'limits': {
'cpus': '0.05',
'cpus': 0.05,
'memory': '50M',
},
'reservations': {
'cpus': '0.01',
'cpus': 0.01,
'memory': '20M',
},
},

View File

@ -14,10 +14,10 @@ services:
max_failure_ratio: 0.3
resources:
limits:
cpus: '0.05'
cpus: 0.05
memory: 50M
reservations:
cpus: '0.01'
cpus: 0.01
memory: 20M
restart_policy:
condition: on-failure