From c202b3f97f8d6435cfd420556302aaf252b8cd49 Mon Sep 17 00:00:00 2001 From: Flavio Crisciani Date: Fri, 28 Jul 2017 13:18:49 -0700 Subject: [PATCH] Allow to set the control plane MTU Add daemon config to allow the user to specify the MTU of the control plane network. The first user of this new parameter is actually libnetwork that can seed the gossip with the proper MTU value allowing to pack multiple messages per UDP packet sent. If the value is not specified or is lower than 1500 the logic will set it to the default. Signed-off-by: Flavio Crisciani Upstream-commit: f9f25ca5e44c89d7c1ebdfa9865076eb2cde9bb2 Component: engine --- components/engine/cmd/dockerd/config.go | 1 + components/engine/daemon/config/config.go | 2 ++ components/engine/daemon/daemon.go | 2 ++ 3 files changed, 5 insertions(+) diff --git a/components/engine/cmd/dockerd/config.go b/components/engine/cmd/dockerd/config.go index 11084ec8d6..fa5565ee46 100644 --- a/components/engine/cmd/dockerd/config.go +++ b/components/engine/cmd/dockerd/config.go @@ -63,6 +63,7 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) { flags.StringVar(&conf.MetricsAddress, "metrics-addr", "", "Set default address and port to serve the metrics api on") flags.StringVar(&conf.NodeGenericResources, "node-generic-resources", "", "user defined resources (e.g. fpga=2;gpu={UUID1,UUID2,UUID3})") + flags.IntVar(&conf.NetworkControlPlaneMTU, "network-control-plane-mtu", config.DefaultNetworkMtu, "Network Control plane MTU") // "--deprecated-key-path" is to allow configuration of the key used // for the daemon ID and the deprecated image signing. It was never diff --git a/components/engine/daemon/config/config.go b/components/engine/daemon/config/config.go index 86a1356c57..5adb7e69e6 100644 --- a/components/engine/daemon/config/config.go +++ b/components/engine/daemon/config/config.go @@ -171,6 +171,8 @@ type CommonConfig struct { // Exposed node Generic Resources NodeGenericResources string `json:"node-generic-resources,omitempty"` + // NetworkControlPlaneMTU allows to specify the control plane MTU, this will allow to optimize the network use in some components + NetworkControlPlaneMTU int `json:"network-control-plane-mtu,omitempty"` } // IsValueSet returns true if a configuration value diff --git a/components/engine/daemon/daemon.go b/components/engine/daemon/daemon.go index e62ef08b69..4d4b98c8de 100644 --- a/components/engine/daemon/daemon.go +++ b/components/engine/daemon/daemon.go @@ -1149,6 +1149,8 @@ func (daemon *Daemon) networkOptions(dconfig *config.Config, pg plugingetter.Plu options = append(options, nwconfig.OptionPluginGetter(pg)) } + options = append(options, nwconfig.OptionNetworkControlPlaneMTU(dconfig.NetworkControlPlaneMTU)) + return options, nil }