Add checkpoint flag per connection type
This commit is contained in:
1 parent
b3ac56e3d2
commit
7c8f33f525
3 files changed
+19
-10
No files matched your search
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/weaveworks/go-checkpoint"
|
||||
weave "github.com/weaveworks/weave/router"
|
||||
)
|
||||
|
||||
var checker *checkpoint.Checker
|
||||
@@ -16,7 +17,7 @@ const (
|
||||
updateCheckPeriod = 6 * time.Hour
|
||||
)
|
||||
|
||||
func checkForUpdates(dockerVersion string, network string) {
|
||||
func checkForUpdates(dockerVersion string, router *weave.NetworkRouter) {
|
||||
newVersion.Store("")
|
||||
success.Store(true)
|
||||
|
||||
@@ -51,9 +52,6 @@ func checkForUpdates(dockerVersion string, network string) {
|
||||
"docker-version": dockerVersion,
|
||||
"kernel-version": kernelVersion,
|
||||
}
|
||||
if network != "" {
|
||||
flags["network"] = network
|
||||
}
|
||||
|
||||
// Start background version checking
|
||||
params := checkpoint.CheckParams{
|
||||
@@ -61,6 +59,21 @@ func checkForUpdates(dockerVersion string, network string) {
|
||||
Version: version,
|
||||
SignatureFile: "",
|
||||
Flags: flags,
|
||||
ExtraFlags: func() []checkpoint.Flag { return checkpointFlags(router) },
|
||||
}
|
||||
checker = checkpoint.CheckInterval(¶ms, updateCheckPeriod, handleResponse)
|
||||
}
|
||||
|
||||
func checkpointFlags(router *weave.NetworkRouter) []checkpoint.Flag {
|
||||
flags := []checkpoint.Flag{}
|
||||
status := weave.NewNetworkRouterStatus(router)
|
||||
for _, conn := range status.Connections {
|
||||
if connectionName, ok := conn.Attrs["name"].(string); ok {
|
||||
if _, encrypted := conn.Attrs["encrypted"]; encrypted {
|
||||
connectionName = connectionName + " encrypted"
|
||||
}
|
||||
flags = append(flags, checkpoint.Flag{Key: "network", Value: connectionName})
|
||||
}
|
||||
}
|
||||
return flags
|
||||
}
|
||||
+1
-5
@@ -275,11 +275,7 @@ func main() {
|
||||
dockerVersion = dockerCli.DockerVersion()
|
||||
}
|
||||
|
||||
network := ""
|
||||
if isAWSVPC {
|
||||
network = "awsvpc"
|
||||
}
|
||||
checkForUpdates(dockerVersion, network)
|
||||
checkForUpdates(dockerVersion, router)
|
||||
|
||||
observeContainers := func(o docker.ContainerObserver) {
|
||||
if dockerCli != nil {
|
||||
|
||||
+1
-1
Submodule vendor/github.com/weaveworks/go-checkpoint updated: 62324982ab...ebbb8b0518.
Reference in new issue
Block a user