Skip to content

Commit

Permalink
Merge pull request #1410 from olljanat/replicas-max-per-node
Browse files Browse the repository at this point in the history
Add maximum replicas per node support to stack version 3.8
  • Loading branch information
thaJeztah authored Feb 20, 2019
2 parents db166da + 6347ab3 commit cfe12f4
Show file tree
Hide file tree
Showing 6 changed files with 658 additions and 5 deletions.
1 change: 1 addition & 0 deletions cli/compose/convert/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func Service(
Placement: &swarm.Placement{
Constraints: service.Deploy.Placement.Constraints,
Preferences: getPlacementPreference(service.Deploy.Placement.Preferences),
MaxReplicas: service.Deploy.Placement.MaxReplicas,
},
},
EndpointSpec: endpoint,
Expand Down
3 changes: 2 additions & 1 deletion cli/compose/loader/full-example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.7"
version: "3.8"

services:
foo:
Expand Down Expand Up @@ -82,6 +82,7 @@ services:
window: 120s
placement:
constraints: [node=foo]
max_replicas_per_node: 5
preferences:
- spread: node.labels.az
endpoint_mode: dnsrr
Expand Down
11 changes: 7 additions & 4 deletions cli/compose/loader/full-struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func fullExampleConfig(workingDir, homeDir string) *types.Config {
return &types.Config{
Version: "3.7",
Version: "3.8",
Services: services(workingDir, homeDir),
Networks: networks(),
Volumes: volumes(),
Expand Down Expand Up @@ -111,6 +111,7 @@ func services(workingDir, homeDir string) []types.ServiceConfig {
},
Placement: types.Placement{
Constraints: []string{"node=foo"},
MaxReplicas: uint64(5),
Preferences: []types.PlacementPreferences{
{
Spread: "node.labels.az",
Expand Down Expand Up @@ -507,7 +508,7 @@ func secrets(workingDir string) map[string]types.SecretConfig {
}

func fullExampleYAML(workingDir string) string {
return fmt.Sprintf(`version: "3.7"
return fmt.Sprintf(`version: "3.8"
services:
foo:
build:
Expand Down Expand Up @@ -588,6 +589,7 @@ services:
- node=foo
preferences:
- spread: node.labels.az
max_replicas_per_node: 5
endpoint_mode: dnsrr
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
Expand Down Expand Up @@ -1083,7 +1085,8 @@ func fullExampleJSON(workingDir string) string {
{
"spread": "node.labels.az"
}
]
],
"max_replicas_per_node": 5
},
"endpoint_mode": "dnsrr"
},
Expand Down Expand Up @@ -1383,7 +1386,7 @@ func fullExampleJSON(workingDir string) string {
"working_dir": "/code"
}
},
"version": "3.7",
"version": "3.8",
"volumes": {
"another-volume": {
"name": "user_specified_name",
Expand Down
44 changes: 44 additions & 0 deletions cli/compose/schema/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cfe12f4

Please sign in to comment.