Merge plugin into weaver
This simplifies the following: - plugin-v2 does not need to start "plugin" as a separate process, thus Docker is able to properly restart plugin-v2 in a case of any child process failing. - No need for weaveplugin container. plugin is enabled by default when running "weave launch". when starting only the router, you should pass "--plugin" parameter to enable it. The env var WEAVE_NO_PLUGIN is no more.
This commit is contained in:
1 parent
8c917eeb17
commit
1f42a9d2f9
11 files changed
+93
-194
No files matched your search
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/weaveworks/weave/nameserver"
|
||||
weavenet "github.com/weaveworks/weave/net"
|
||||
"github.com/weaveworks/weave/net/address"
|
||||
"github.com/weaveworks/weave/plugin"
|
||||
weave "github.com/weaveworks/weave/router"
|
||||
)
|
||||
|
||||
@@ -150,6 +151,10 @@ func main() {
|
||||
discoveryEndpoint string
|
||||
token string
|
||||
advertiseAddress string
|
||||
pluginSocket string
|
||||
pluginMeshSocket string
|
||||
noMulticastRoute bool
|
||||
enablePlugin bool
|
||||
|
||||
defaultDockerHost = "unix:///var/run/docker.sock"
|
||||
)
|
||||
@@ -195,6 +200,11 @@ func main() {
|
||||
mflag.StringVar(&token, []string{"-token"}, "", "token for peer discovery")
|
||||
mflag.StringVar(&advertiseAddress, []string{"-advertise-address"}, "", "address to advertise for peer discovery")
|
||||
|
||||
mflag.BoolVar(&enablePlugin, []string{"-plugin"}, false, "enable Docker plugin")
|
||||
mflag.StringVar(&pluginSocket, []string{"-plugin-socket"}, "/run/docker/plugins/weave.sock", "plugin socket on which to listen")
|
||||
mflag.StringVar(&pluginMeshSocket, []string{"-plugin-mesh-socket"}, "/run/docker/plugins/weavemesh.sock", "plugin socket on which to listen in mesh mode")
|
||||
mflag.BoolVar(&noMulticastRoute, []string{"-no-multicast-route"}, false, "deprecated (this is now the default)")
|
||||
|
||||
// crude way of detecting that we probably have been started in a
|
||||
// container, with `weave launch` --> suppress misleading paths in
|
||||
// mflags error messages.
|
||||
@@ -396,6 +406,11 @@ func main() {
|
||||
go listenAndServeHTTP(statusAddr, statusMux)
|
||||
}
|
||||
|
||||
if enablePlugin {
|
||||
// TODO(mp) do not pass pluginMeshSocket if plugin-v2 is in use
|
||||
go plugin.Start(httpAddr, dockerAPI, pluginSocket, pluginMeshSocket, noMulticastRoute)
|
||||
}
|
||||
|
||||
signals.SignalHandlerLoop(common.Log, router)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user