Merge will include deploy resources (#1214)

This commit is contained in:
Hang Yan 2019-12-27 13:51:11 +08:00 committed by GitHub
parent a3a82f55fe
commit d2d0d61cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -555,6 +555,14 @@ func mergeComposeObject(oldCompose *types.Config, newCompose *types.Config) (*ty
if service.Deploy.Mode != "" {
tmpOldService.Deploy = service.Deploy
}
if service.Deploy.Resources.Limits != nil {
tmpOldService.Deploy.Resources.Limits = service.Deploy.Resources.Limits
}
if service.Deploy.Resources.Reservations != nil {
tmpOldService.Deploy.Resources.Reservations = service.Deploy.Resources.Reservations
}
if len(service.Devices) != 0 {
tmpOldService.Devices = service.Devices
}

View File

@ -2,6 +2,12 @@ version: '3'
services:
web:
deploy:
resources:
limits:
cpus: "1" # as opposed to 0.1 (default)
reservations:
cpus: "1"
environment:
- ERRORS=1
- HIDE_NGINX_HEADERS=0

View File

@ -68,7 +68,14 @@
"image": "richarvey/nginx-php-fpm",
"imagePullPolicy": "",
"name": "web",
"resources": {}
"resources": {
"limits": {
"cpu": "1"
},
"requests": {
"cpu": "1"
}
}
}
],
"restartPolicy": "Always",