mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 03:46:45 +00:00
Revert "Revert "Merge pull request #2285 from weaveworks/mike/k8s-ns-in-container-view""
This reverts commit d55c528fe2.
This commit is contained in:
+13
-2
@@ -10,6 +10,10 @@ import (
|
||||
"github.com/weaveworks/scope/report"
|
||||
)
|
||||
|
||||
const (
|
||||
k8sNamespaceLabel = "io.kubernetes.pod.namespace"
|
||||
)
|
||||
|
||||
// PreciousNodeRenderer ensures a node is never filtered out by decorators
|
||||
type PreciousNodeRenderer struct {
|
||||
PreciousNodeID string
|
||||
@@ -281,7 +285,7 @@ func IsApplication(n report.Node) bool {
|
||||
if roleLabel == "system" {
|
||||
return false
|
||||
}
|
||||
namespace, _ := n.Latest.Lookup(docker.LabelPrefix + "io.kubernetes.pod.namespace")
|
||||
namespace, _ := n.Latest.Lookup(docker.LabelPrefix + k8sNamespaceLabel)
|
||||
if namespace == "kube-system" {
|
||||
return false
|
||||
}
|
||||
@@ -320,7 +324,14 @@ func IsNotPseudo(n report.Node) bool {
|
||||
// IsNamespace checks if the node is a pod/service in the specified namespace
|
||||
func IsNamespace(namespace string) FilterFunc {
|
||||
return func(n report.Node) bool {
|
||||
gotNamespace, _ := n.Latest.Lookup(kubernetes.Namespace)
|
||||
tryKeys := []string{kubernetes.Namespace, docker.LabelPrefix + k8sNamespaceLabel}
|
||||
gotNamespace := ""
|
||||
for _, key := range tryKeys {
|
||||
if value, ok := n.Latest.Lookup(key); ok {
|
||||
gotNamespace = value
|
||||
break
|
||||
}
|
||||
}
|
||||
return namespace == gotNamespace
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user