mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add ulimits support to services
Add Ulimits field to the ContainerSpec API type and wire it to Swarmkit. This is related to #40639. Signed-off-by: Albin Kerouanton <albin@akerouanton.name>
This commit is contained in:
parent
1fdb1033c4
commit
c76f380bea
7 changed files with 81 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/go-units"
|
||||
)
|
||||
|
||||
func TestAdjustForAPIVersion(t *testing.T) {
|
||||
|
|
@ -39,6 +40,13 @@ func TestAdjustForAPIVersion(t *testing.T) {
|
|||
ConfigName: "configRuntime",
|
||||
},
|
||||
},
|
||||
Ulimits: []*units.Ulimit{
|
||||
{
|
||||
Name: "nofile",
|
||||
Soft: 100,
|
||||
Hard: 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
Placement: &swarm.Placement{
|
||||
MaxReplicas: 222,
|
||||
|
|
@ -78,6 +86,10 @@ func TestAdjustForAPIVersion(t *testing.T) {
|
|||
t.Error("MaxReplicas was stripped from spec")
|
||||
}
|
||||
|
||||
if len(spec.TaskTemplate.ContainerSpec.Ulimits) == 0 {
|
||||
t.Error("Ulimits were stripped from spec")
|
||||
}
|
||||
|
||||
// next, does calling this with an earlier version correctly strip fields?
|
||||
adjustForAPIVersion("1.29", spec)
|
||||
if spec.TaskTemplate.ContainerSpec.Sysctls != nil {
|
||||
|
|
@ -100,4 +112,8 @@ func TestAdjustForAPIVersion(t *testing.T) {
|
|||
t.Error("MaxReplicas was not stripped from spec")
|
||||
}
|
||||
|
||||
if len(spec.TaskTemplate.ContainerSpec.Ulimits) != 0 {
|
||||
t.Error("Ulimits were not stripped from spec")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue