1
0
mirror of https://github.com/docker/cli.git synced 2026-01-23 15:21:32 +03:00

Add support for pids limit in stacks (swarm)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2020-05-09 23:08:42 +02:00
parent 395a6d560d
commit 851eeb9639
9 changed files with 72 additions and 47 deletions

View File

@@ -489,11 +489,22 @@ func fromComposeConstraints(s []string) *latest.Constraints {
func fromComposeResources(r composeTypes.Resources) latest.Resources {
return latest.Resources{
Limits: fromComposeResourcesResource(r.Limits),
Limits: fromComposeResourcesResourceLimit(r.Limits),
Reservations: fromComposeResourcesResource(r.Reservations),
}
}
// TODO create ResourceLimit type and support for limiting Pids on k8s
func fromComposeResourcesResourceLimit(r *composeTypes.ResourceLimit) *latest.Resource {
if r == nil {
return nil
}
return &latest.Resource{
MemoryBytes: int64(r.MemoryBytes),
NanoCPUs: r.NanoCPUs,
}
}
func fromComposeResourcesResource(r *composeTypes.Resource) *latest.Resource {
if r == nil {
return nil