mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
add isKindToBeGrouped
This commit is contained in:
@@ -138,7 +138,7 @@ func (printer *PrettyPrinter) printGroupedResources(workloads map[string][]Workl
|
||||
|
||||
for ns, rsc := range workloads {
|
||||
preIndent := indent
|
||||
if ns == "Group" || ns == "User" {
|
||||
if isKindToBeGrouped(ns) {
|
||||
cautils.SimpleDisplay(printer.writer, "%s%ss\n", indent, ns)
|
||||
} else if ns != "" {
|
||||
cautils.SimpleDisplay(printer.writer, "%sNamespace %s\n", indent, ns)
|
||||
|
||||
@@ -12,7 +12,7 @@ func groupByNamespaceOrKind(resources []WorkloadSummary, status func(workloadSum
|
||||
mapResources := make(map[string][]WorkloadSummary)
|
||||
for i := range resources {
|
||||
if status(&resources[i]) {
|
||||
if resources[i].Namespace == "" && (resources[i].Kind == "Group" || resources[i].Kind == "User") {
|
||||
if resources[i].Namespace == "" && isKindToBeGrouped(resources[i].Kind) {
|
||||
if r, ok := mapResources[resources[i].Kind]; ok {
|
||||
r = append(r, resources[i])
|
||||
mapResources[resources[i].Kind] = r
|
||||
@@ -29,6 +29,14 @@ func groupByNamespaceOrKind(resources []WorkloadSummary, status func(workloadSum
|
||||
}
|
||||
return mapResources
|
||||
}
|
||||
|
||||
func isKindToBeGrouped(kind string) bool {
|
||||
if kind == "Group" || kind == "User" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func listResultSummary(ruleReports []reporthandling.RuleReport) []WorkloadSummary {
|
||||
workloadsSummary := []WorkloadSummary{}
|
||||
track := map[string]bool{}
|
||||
|
||||
Reference in New Issue
Block a user