mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Gather Weave Net plugin and proxy info from report
Instead of using Docker, because after Weave Net 2.0 there are no proxy nor plugin containers. This has the drawback of not detecting the plugin/proxy in systems running Weave Net < 2.0 , but I think we can live with it.
This commit is contained in:
@@ -34,6 +34,8 @@ type Status struct {
|
||||
Router Router
|
||||
DNS *DNS
|
||||
IPAM *IPAM
|
||||
Proxy *Proxy
|
||||
Plugin *Plugin
|
||||
}
|
||||
|
||||
// Router describes the status of the Weave Router
|
||||
@@ -95,6 +97,16 @@ type IPAM struct {
|
||||
PendingAllocates []string
|
||||
}
|
||||
|
||||
// Proxy describes the status of Weave Proxy
|
||||
type Proxy struct {
|
||||
Addresses []string
|
||||
}
|
||||
|
||||
// Plugin describes the status of the Weave Plugin
|
||||
type Plugin struct {
|
||||
DriverName string
|
||||
}
|
||||
|
||||
var weavePsMatch = regexp.MustCompile(`^([0-9a-f]{12}) ((?:[0-9a-f][0-9a-f]\:){5}(?:[0-9a-f][0-9a-f]))(.*)$`)
|
||||
var ipMatch = regexp.MustCompile(`([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})(/[0-9]+)`)
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ const (
|
||||
mockContainerIP = "10.0.0.123"
|
||||
mockContainerIPWithScope = ";10.0.0.123"
|
||||
mockHostname = "hostname.weave.local"
|
||||
mockProxyAddress = "unix:///foo/bar/weave.sock"
|
||||
mockDriverName = "weave_mock"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -41,8 +43,16 @@ var (
|
||||
"Hostname": "%s.",
|
||||
"Tombstone": 0
|
||||
}]
|
||||
}
|
||||
}`, mockWeavePeerName, mockWeavePeerNickName, mockContainerID, mockHostname)
|
||||
},
|
||||
"Proxy": {
|
||||
"Addresses": [
|
||||
"%s"
|
||||
]
|
||||
},
|
||||
"Plugin": {
|
||||
"DriverName": "%s"
|
||||
}
|
||||
}`, mockWeavePeerName, mockWeavePeerNickName, mockContainerID, mockHostname, mockProxyAddress, mockDriverName)
|
||||
mockIP = net.ParseIP("1.2.3.4")
|
||||
)
|
||||
|
||||
@@ -84,6 +94,12 @@ func TestStatus(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
Proxy: &weave.Proxy{
|
||||
Addresses: []string{mockProxyAddress},
|
||||
},
|
||||
Plugin: &weave.Plugin{
|
||||
DriverName: mockDriverName,
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(status, want) {
|
||||
t.Fatal(test.Diff(status, want))
|
||||
|
||||
Reference in New Issue
Block a user