Skip to content

Commit d156151

Browse files
authored
Merge pull request #49 from aboch/nlo2
Add network create flags --scope, --config-only, --config-from
2 parents 74cc280 + f7415aa commit d156151

9 files changed

Lines changed: 76 additions & 13 deletions

File tree

cli/command/network/create.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ import (
1818

1919
type createOptions struct {
2020
name string
21+
scope string
2122
driver string
2223
driverOpts opts.MapOpts
2324
labels opts.ListOpts
2425
internal bool
2526
ipv6 bool
2627
attachable bool
2728
ingress bool
29+
configOnly bool
30+
configFrom string
2831

2932
ipamDriver string
3033
ipamSubnet []string
@@ -62,6 +65,12 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
6265
flags.SetAnnotation("attachable", "version", []string{"1.25"})
6366
flags.BoolVar(&options.ingress, "ingress", false, "Create swarm routing-mesh network")
6467
flags.SetAnnotation("ingress", "version", []string{"1.29"})
68+
flags.StringVar(&options.scope, "scope", "", "Control the network's scope")
69+
flags.SetAnnotation("scope", "version", []string{"1.30"})
70+
flags.BoolVar(&options.configOnly, "config-only", false, "Create a configuration only network")
71+
flags.SetAnnotation("config-only", "version", []string{"1.30"})
72+
flags.StringVar(&options.configFrom, "config-from", "", "The network from which copying the configuration")
73+
flags.SetAnnotation("config-from", "version", []string{"1.30"})
6574

6675
flags.StringVar(&options.ipamDriver, "ipam-driver", "default", "IP Address Management Driver")
6776
flags.StringSliceVar(&options.ipamSubnet, "subnet", []string{}, "Subnet in CIDR format that represents a network segment")
@@ -96,9 +105,17 @@ func runCreate(dockerCli *command.DockerCli, options createOptions) error {
96105
EnableIPv6: options.ipv6,
97106
Attachable: options.attachable,
98107
Ingress: options.ingress,
108+
Scope: options.scope,
109+
ConfigOnly: options.configOnly,
99110
Labels: runconfigopts.ConvertKVStringsToMap(options.labels.GetAll()),
100111
}
101112

113+
if from := options.configFrom; from != "" {
114+
nc.ConfigFrom = &network.ConfigReference{
115+
Network: from,
116+
}
117+
}
118+
102119
resp, err := client.NetworkCreate(context.Background(), options.name, nc)
103120
if err != nil {
104121
return err

vendor.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c
66
github.com/coreos/etcd 824277cb3a577a0e8c829ca9ec557b973fe06d20
77
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
88
github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621
9-
github.com/docker/docker 77c9728847358a3ed3581d828fb0753017e1afd3
9+
github.com/docker/docker 4874e05f7452d7d9c60db50296d04c802ce76ae1
1010
github.com/docker/docker-credential-helpers v0.5.0
1111
github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06
1212
github.com/docker/go-connections e15c02316c12de00874640cd76311849de2aeed5

vendor/github.com/docker/docker/api/types/events/events.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/docker/api/types/network/network.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/docker/api/types/swarm/network.go

Lines changed: 12 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/docker/api/types/types.go

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/docker/client/service_create.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/docker/client/service_update.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/docker/vendor.conf

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)