Move plugin network creation from shell script to Go
In the process, use the default subnet instead of the whole IP allocation range.
This commit is contained in:
1 parent
eab5ec206a
commit
d2cbb2749e
6 files changed
+34
-60
No files matched your search
+4
-18
@@ -1,9 +1,7 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
@@ -18,7 +16,10 @@ import (
|
||||
"github.com/weaveworks/weave/plugin/skel"
|
||||
)
|
||||
|
||||
const pluginV2Name = "net-plugin"
|
||||
const (
|
||||
pluginV2Name = "net-plugin"
|
||||
MulticastOption = netplugin.MulticastOption
|
||||
)
|
||||
|
||||
var Log = common.Log
|
||||
|
||||
@@ -54,12 +55,6 @@ func run(dockerClient *docker.Client, weave *weaveapi.Client, address, meshAddre
|
||||
defer meshListener.Close()
|
||||
}
|
||||
|
||||
statusListener, err := weavenet.ListenUnixSocket("/home/weave/plugin-status.sock")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
go serveStatus(statusListener)
|
||||
|
||||
return <-endChan
|
||||
}
|
||||
|
||||
@@ -98,12 +93,3 @@ func listenAndServe(dockerClient *docker.Client, weave *weaveapi.Client, address
|
||||
|
||||
return listener, nil
|
||||
}
|
||||
|
||||
func serveStatus(listener net.Listener) {
|
||||
server := &http.Server{Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "ok")
|
||||
})}
|
||||
if err := server.Serve(listener); err != nil {
|
||||
Log.Fatalf("ListenAndServeStatus failed: %s", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user