-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Probe reports namespaces #2985
Probe reports namespaces #2985
Conversation
report/report.go
Outdated
// Probes did not use to report namespace ids, but since creating a report node requires an id, | ||
// the namespace name, which is unique, is passed to `MakeNamespaceNodeID | ||
namespaceID := MakeNamespaceNodeID(ns) | ||
nodes[namespaceID] = MakeNodeWith(namespaceID, map[string]string{KubernetesName: ns}) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
report/report.go
Outdated
@@ -41,6 +42,13 @@ const ( | |||
|
|||
// Used when counting the number of containers | |||
ContainersKey = "containers" | |||
|
|||
// The following constants are defined in github.com/weaveworks/scope/kubernetes, |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
report/report.go
Outdated
// and are redefined to avoid import cycles. | ||
KubernetesState = "kubernetes_state" | ||
KubernetesName = "kubernetes_name" | ||
KubernetesNamespace = "kubernetes_namespace" |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
report/report.go
Outdated
KubernetesState = "kubernetes_state" | ||
KubernetesName = "kubernetes_name" | ||
KubernetesNamespace = "kubernetes_namespace" | ||
KubernetesStateDeleted = "delete" |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
probe/kubernetes/namespace.go
Outdated
// 1. Declaring a Namespace interface clashes with the already existent kubernetes.Namespace constant in meta.go. | ||
// This can be solved by naming the interface differently, but there's second issue: | ||
// 2. Defining a Namespace implementation and composing it with *apiv1.Namespace and Meta also produces name clashes | ||
// between *apiv1.Namespace and meta.Namespace() |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
1e7a84e
to
6c906a7
Compare
6c906a7
to
53c2ab7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of niggles. fine otherwise.
report/report.go
Outdated
nodes := Nodes{} | ||
for ns := range namespaces { | ||
// Namespace ID: | ||
// Probes did not use to report namespace ids, but since creating a report node requires an id, |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
report/report.go
Outdated
} | ||
} | ||
|
||
nodes := Nodes{} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
report/report_test.go
Outdated
@@ -7,6 +7,7 @@ import ( | |||
|
|||
"github.com/weaveworks/common/mtime" | |||
"github.com/weaveworks/common/test" | |||
"github.com/weaveworks/scope/probe/kubernetes" |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
app/api_topologies.go
Outdated
if !ok { | ||
log.Errorf("Error while fetching the namespace's name: %v", n) | ||
continue | ||
} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Old probes do not report namespace topologies. `report.upgradeNamespaces()` recontructs namespace topologies using the data available from other kubernetes resources. Also, add a test.
This avoids unnecessary loops.
53c2ab7
to
1fb23dd
Compare
If the probe reports namespace topologies, the app, in particular
updateKubeFilters()
, is able to avoid unnecessary loops.Fixes #2945.
This PR also fixes incorrect comments and removes
WalkNodes()
which was unused.