Skip to content
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

Merged
merged 4 commits into from
Jan 3, 2018
Merged

Probe reports namespaces #2985

merged 4 commits into from
Jan 3, 2018

Conversation

rbruggem
Copy link
Contributor

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.

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.

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.

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.

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.

// 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.

Copy link
Member

@rade rade left a 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.

report/report.go Outdated
}
}

nodes := Nodes{}

This comment was marked as abuse.

@@ -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.

if !ok {
log.Errorf("Error while fetching the namespace's name: %v", n)
continue
}

This comment was marked as abuse.

Roberto Bruggemann added 4 commits January 3, 2018 13:55
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.
@rbruggem rbruggem merged commit e2e0496 into master Jan 3, 2018
@rbruggem rbruggem deleted the report-namespaces branch January 3, 2018 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

namespace filter calculation is horrendously inefficient
2 participants