mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
added pass resources in policy report
This commit is contained in:
parent
a7a5c07f84
commit
aaa2b96b35
2 changed files with 8 additions and 1 deletions
|
@ -17,6 +17,7 @@ import (
|
||||||
"github.com/kyverno/kyverno/pkg/engine/context"
|
"github.com/kyverno/kyverno/pkg/engine/context"
|
||||||
"github.com/kyverno/kyverno/pkg/engine/response"
|
"github.com/kyverno/kyverno/pkg/engine/response"
|
||||||
"github.com/kyverno/kyverno/pkg/kyverno/common"
|
"github.com/kyverno/kyverno/pkg/kyverno/common"
|
||||||
|
pkgCommon "github.com/kyverno/kyverno/pkg/common"
|
||||||
"github.com/kyverno/kyverno/pkg/kyverno/sanitizedError"
|
"github.com/kyverno/kyverno/pkg/kyverno/sanitizedError"
|
||||||
"github.com/kyverno/kyverno/pkg/openapi"
|
"github.com/kyverno/kyverno/pkg/openapi"
|
||||||
policy2 "github.com/kyverno/kyverno/pkg/policy"
|
policy2 "github.com/kyverno/kyverno/pkg/policy"
|
||||||
|
@ -299,6 +300,7 @@ func getResourceAccordingToResourcePath(resourcePaths []string, cluster bool, po
|
||||||
// printReportOrViolation - printing policy report/violations
|
// printReportOrViolation - printing policy report/violations
|
||||||
func printReportOrViolation(policyReport bool, engineResponses []response.EngineResponse, rc *resultCounts, resourcePaths []string) {
|
func printReportOrViolation(policyReport bool, engineResponses []response.EngineResponse, rc *resultCounts, resourcePaths []string) {
|
||||||
if policyReport {
|
if policyReport {
|
||||||
|
os.Setenv("POLICY-TYPE", pkgCommon.PolicyReport)
|
||||||
resps := buildPolicyReports(engineResponses)
|
resps := buildPolicyReports(engineResponses)
|
||||||
if len(resps) > 0 {
|
if len(resps) > 0 {
|
||||||
fmt.Println("----------------------------------------------------------------------\nPOLICY REPORT:\n----------------------------------------------------------------------")
|
fmt.Println("----------------------------------------------------------------------\nPOLICY REPORT:\n----------------------------------------------------------------------")
|
||||||
|
|
|
@ -120,7 +120,12 @@ func mergeResults(report *unstructured.Unstructured, results *[]interface{}) {
|
||||||
|
|
||||||
func updateSummary(results []interface{}) map[string]interface{} {
|
func updateSummary(results []interface{}) map[string]interface{} {
|
||||||
summary := make(map[string]interface{})
|
summary := make(map[string]interface{})
|
||||||
|
status := []string{report.StatusPass, report.StatusFail, report.StatusError, report.StatusSkip, report.StatusWarn}
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
if _, ok := summary[status[i]].(int64); !ok {
|
||||||
|
summary[status[i]] = int64(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
typedResult, ok := result.(map[string]interface{})
|
typedResult, ok := result.(map[string]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Add table
Reference in a new issue