sunguroku 5 лет назад
Родитель
Сommit
c0a935db7c
2 измененных файлов с 6 добавлено и 4 удалено
  1. 1 1
      internal/helm/grapher/object.go
  2. 5 3
      internal/helm/grapher/relation.go

+ 1 - 1
internal/helm/grapher/object.go

@@ -22,7 +22,7 @@ func ParseObjs(objs []map[string]interface{}) []Object {
 		namespace := getField(obj, "metadata", "namespace")
 
 		if namespace == nil {
-			namespace = ""
+			namespace = "default"
 		}
 
 		// First add the object that appears on the YAML

+ 5 - 3
internal/helm/grapher/relation.go

@@ -1,6 +1,7 @@
 package grapher
 
 import (
+	"fmt"
 	"strconv"
 )
 
@@ -285,11 +286,12 @@ func (parsed *ParsedObjs) findRBACTargets(parentID int, yaml map[string]interfac
 					Target: o.ID,
 				},
 			}
-
+			fmt.Println(tr["namespace"], o.Kind, tr["kind"], o.Name, tr["name"])
 			// first consider case of targets added via subjects, which are namespace scoped.
-			if tr["namespace"] != nil && o.Kind == tr["kind"] &&
-				o.Name == tr["name"] && (o.Namespace == tr["namespace"] || o.Namespace == "default") {
+			if tr["namespace"] != nil && o.Kind == tr["kind"] && o.Name == tr["name"] &&
+				(o.Namespace == tr["namespace"] || o.Namespace == "default") {
 
+				fmt.Println("subject", o.Name, tr["kind"])
 				// Add bidirectional link from children as well.
 				parsed.Objects[i].Relations.SpecRels = append(parsed.Objects[i].Relations.SpecRels, newrel)
 				targets = append(targets, o.ID)