Skip to content

Commit 31d1a59

Browse files
authored
Merge pull request #6642 from vvoland/swarm-compose-work
swarm: revert compose/stack support for memory swappiness
2 parents 179efae + ad96811 commit 31d1a59

File tree

11 files changed

+10
-722
lines changed

11 files changed

+10
-722
lines changed

cli/compose/convert/service.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,6 @@ func convertResources(source composetypes.Resources) (*swarm.ResourceRequirement
560560
GenericResources: generic,
561561
}
562562
}
563-
// These fields are themselves pointers -- we can simply assign, no need to
564-
// nil-check them. Nil is nil.
565-
resources.SwapBytes = source.MemswapLimit
566-
resources.MemorySwappiness = source.MemSwappiness
567563
return resources, nil
568564
}
569565

cli/compose/convert/service_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ func TestConvertExtraHosts(t *testing.T) {
8181
}
8282

8383
func TestConvertResourcesFull(t *testing.T) {
84-
// create some variables so we can get pointers
85-
memswap := int64(72090)
86-
swappiness := int64(27)
8784
source := composetypes.Resources{
8885
Limits: &composetypes.ResourceLimit{
8986
NanoCPUs: "0.003",
@@ -93,8 +90,6 @@ func TestConvertResourcesFull(t *testing.T) {
9390
NanoCPUs: "0.002",
9491
MemoryBytes: composetypes.UnitBytes(200000000),
9592
},
96-
MemswapLimit: &memswap,
97-
MemSwappiness: &swappiness,
9893
}
9994
resources, err := convertResources(source)
10095
assert.NilError(t, err)
@@ -108,8 +103,6 @@ func TestConvertResourcesFull(t *testing.T) {
108103
NanoCPUs: 2000000,
109104
MemoryBytes: 200000000,
110105
},
111-
SwapBytes: &memswap,
112-
MemorySwappiness: &swappiness,
113106
}
114107
assert.Check(t, is.DeepEqual(expected, resources))
115108
}

cli/compose/loader/full-example.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3.14"
1+
version: "3.13"
22

33
services:
44
foo:
@@ -79,8 +79,6 @@ services:
7979
- discrete_resource_spec:
8080
kind: 'ssd'
8181
value: 1
82-
memswap_limit: 86000
83-
mem_swappiness: 27
8482
restart_policy:
8583
condition: on-failure
8684
delay: 5s

cli/compose/loader/full-struct_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func fullExampleConfig(workingDir, homeDir string) *types.Config {
1313
return &types.Config{
14-
Version: "3.14",
14+
Version: "3.13",
1515
Services: services(workingDir, homeDir),
1616
Networks: networks(),
1717
Volumes: volumes(),
@@ -108,8 +108,6 @@ func services(workingDir, homeDir string) []types.ServiceConfig {
108108
},
109109
},
110110
},
111-
MemswapLimit: int64Ptr(86000),
112-
MemSwappiness: int64Ptr(27),
113111
},
114112
RestartPolicy: &types.RestartPolicy{
115113
Condition: "on-failure",

cli/compose/loader/loader_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func strPtr(val string) *string {
184184
}
185185

186186
var sampleConfig = types.Config{
187-
Version: "3.14",
187+
Version: "3.13",
188188
Services: []types.ServiceConfig{
189189
{
190190
Name: "foo",
@@ -970,10 +970,6 @@ func uint32Ptr(value uint32) *uint32 {
970970
return &value
971971
}
972972

973-
func int64Ptr(value int64) *int64 {
974-
return &value
975-
}
976-
977973
func TestFullExample(t *testing.T) {
978974
skip.If(t, runtime.GOOS == "windows", "FIXME: substitutes platform-specific HOME-dirs and requires platform-specific golden files; see https://github.com/docker/cli/pull/4610")
979975

cli/compose/loader/testdata/full-example.json.golden

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@
181181
}
182182
}
183183
]
184-
},
185-
"memswap_limit": 86000,
186-
"mem_swappiness": 27
184+
}
187185
},
188186
"restart_policy": {
189187
"condition": "on-failure",
@@ -515,7 +513,7 @@
515513
"working_dir": "/code"
516514
}
517515
},
518-
"version": "3.14",
516+
"version": "3.13",
519517
"volumes": {
520518
"another-volume": {
521519
"name": "user_specified_name",

cli/compose/loader/testdata/full-example.yaml.golden

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3.14"
1+
version: "3.13"
22
services:
33
foo:
44
build:
@@ -73,8 +73,6 @@ services:
7373
- discrete_resource_spec:
7474
kind: ssd
7575
value: 1
76-
memswap_limit: 86000
77-
mem_swappiness: 27
7876
restart_policy:
7977
condition: on-failure
8078
delay: 5s

0 commit comments

Comments
 (0)