1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-29 02:45:06 +00:00

update summary.* to lower case

This commit is contained in:
Shuting Zhao 2020-10-30 18:01:46 -07:00
parent ba4b36153d
commit e5c5cb39a0
15 changed files with 321 additions and 445 deletions

View file

@ -288,19 +288,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -482,11 +482,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -572,23 +572,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -695,19 +695,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -887,11 +887,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -977,23 +977,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -1351,19 +1351,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -1544,11 +1544,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -1634,23 +1634,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -1757,19 +1757,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -1949,11 +1949,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -2039,23 +2039,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer

View file

@ -17,19 +17,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -211,11 +211,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -301,23 +301,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer

View file

@ -17,19 +17,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -209,11 +209,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -299,23 +299,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer

View file

@ -17,19 +17,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -210,11 +210,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -300,23 +300,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer

View file

@ -17,19 +17,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -209,11 +209,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -299,23 +299,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer

View file

@ -293,19 +293,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -487,11 +487,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -577,23 +577,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -700,19 +700,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -892,11 +892,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -982,23 +982,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -1356,19 +1356,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -1549,11 +1549,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -1639,23 +1639,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -1762,19 +1762,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -1954,11 +1954,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -2044,23 +2044,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer

View file

@ -293,19 +293,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -487,11 +487,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -577,23 +577,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -700,19 +700,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -892,11 +892,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -982,23 +982,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -1356,19 +1356,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -1549,11 +1549,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -1639,23 +1639,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer
@ -1762,19 +1762,19 @@ spec:
name: Name
priority: 1
type: string
- JSONPath: .summary.Pass
- JSONPath: .summary.pass
name: Pass
type: integer
- JSONPath: .summary.Fail
- JSONPath: .summary.fail
name: Fail
type: integer
- JSONPath: .summary.Warn
- JSONPath: .summary.warn
name: Warn
type: integer
- JSONPath: .summary.Error
- JSONPath: .summary.error
name: Error
type: integer
- JSONPath: .summary.Skip
- JSONPath: .summary.skip
name: Skip
type: integer
- JSONPath: .metadata.creationTimestamp
@ -1954,11 +1954,11 @@ spec:
status:
description: Status indicates the result of the policy rule check
enum:
- Pass
- Fail
- Warn
- Error
- Skip
- pass
- fail
- warn
- error
- skip
type: string
required:
- policy
@ -2044,23 +2044,23 @@ spec:
summary:
description: PolicyReportSummary provides a summary of results
properties:
Error:
error:
description: Error provides the count of policies that could not be
evaluated
type: integer
Fail:
fail:
description: Fail provides the count of policies whose requirements
were not met
type: integer
Pass:
pass:
description: Pass provides the count of policies whose requirements
were met
type: integer
Skip:
skip:
description: Skip indicates the count of policies that were not selected
for evaluation
type: integer
Warn:
warn:
description: Warn provides the count of unscored policies whose requirements
were not met
type: integer

View file

@ -30,11 +30,11 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Kind",type=string,JSONPath=`.scope.kind`,priority=1
// +kubebuilder:printcolumn:name="Name",type=string,JSONPath=`.scope.name`,priority=1
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.Pass`
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.Fail`
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.Warn`
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.Error`
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.Skip`
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.pass`
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.fail`
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.warn`
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.error`
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.skip`
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:resource:shortName=cpolr

View file

@ -30,11 +30,11 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Kind",type=string,JSONPath=`.scope.kind`,priority=1
// +kubebuilder:printcolumn:name="Name",type=string,JSONPath=`.scope.name`,priority=1
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.Pass`
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.Fail`
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.Warn`
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.Error`
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.Skip`
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.pass`
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.fail`
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.warn`
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.error`
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.skip`
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// ClusterReportChangeRequest is the Schema for the ClusterReportChangeRequests API

View file

@ -22,11 +22,11 @@ import (
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
const (
StatusPass = "Pass"
StatusFail = "Fail"
StatusWarn = "Warn"
StatusError = "Error"
StatusSkip = "Skip"
StatusPass = "pass"
StatusFail = "fail"
StatusWarn = "warn"
StatusError = "error"
StatusSkip = "skip"
)
// PolicyReportSummary provides a status count summary
@ -34,33 +34,33 @@ type PolicyReportSummary struct {
// Pass provides the count of policies whose requirements were met
// +optional
Pass int `json:"Pass"`
Pass int `json:"pass"`
// Fail provides the count of policies whose requirements were not met
// +optional
Fail int `json:"Fail"`
Fail int `json:"fail"`
// Warn provides the count of unscored policies whose requirements were not met
// +optional
Warn int `json:"Warn"`
Warn int `json:"warn"`
// Error provides the count of policies that could not be evaluated
// +optional
Error int `json:"Error"`
Error int `json:"error"`
// Skip indicates the count of policies that were not selected for evaluation
// +optional
Skip int `json:"Skip"`
Skip int `json:"skip"`
}
// PolicyStatus has one of the following values:
// - Pass: indicates that the policy requirements are met
// - Fail: indicates that the policy requirements are not met
// - Warn: indicates that the policy requirements and not met, and the policy is not scored
// - Error: indicates that the policy could not be evaluated
// - Skip: indicates that the policy was not selected based on user inputs or applicability
// - pass: indicates that the policy requirements are met
// - fail: indicates that the policy requirements are not met
// - warn: indicates that the policy requirements and not met, and the policy is not scored
// - error: indicates that the policy could not be evaluated
// - skip: indicates that the policy was not selected based on user inputs or applicability
//
// +kubebuilder:validation:Enum=Pass;Fail;Warn;Error;Skip
// +kubebuilder:validation:Enum=pass;fail;warn;error;skip
type PolicyStatus string
// PolicySeverity has one of the following values:
@ -117,11 +117,11 @@ type PolicyReportResult struct {
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Kind",type=string,JSONPath=`.scope.kind`,priority=1
// +kubebuilder:printcolumn:name="Name",type=string,JSONPath=`.scope.name`,priority=1
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.Pass`
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.Fail`
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.Warn`
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.Error`
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.Skip`
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.pass`
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.fail`
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.warn`
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.error`
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.skip`
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:resource:shortName=polr

View file

@ -29,11 +29,11 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Kind",type=string,JSONPath=`.scope.kind`,priority=1
// +kubebuilder:printcolumn:name="Name",type=string,JSONPath=`.scope.name`,priority=1
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.Pass`
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.Fail`
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.Warn`
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.Error`
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.Skip`
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.pass`
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.fail`
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.warn`
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.error`
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.skip`
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// ReportChangeRequest is the Schema for the ReportChangeRequests API

View file

@ -134,25 +134,25 @@ func updateSummary(results []interface{}) map[string]interface{} {
continue
}
pass, _ := summary["Pass"].(int64)
pass, _ := summary[report.StatusPass].(int64)
pass += int64(len(resources))
summary["Pass"] = pass
summary[report.StatusPass] = pass
case report.StatusFail:
fail, _ := summary["Fail"].(int64)
fail, _ := summary[report.StatusFail].(int64)
fail++
summary["Fail"] = fail
case "Warn":
warn, _ := summary["Warn"].(int64)
summary[report.StatusFail] = fail
case report.StatusWarn:
warn, _ := summary[report.StatusWarn].(int64)
warn++
summary["warn"] = warn
case "Error":
e, _ := summary["Error"].(int64)
summary[report.StatusWarn] = warn
case report.StatusError:
e, _ := summary[report.StatusError].(int64)
e++
summary["Error"] = e
case "Skip":
skip, _ := summary["Skip"].(int64)
summary[report.StatusError] = e
case report.StatusSkip:
skip, _ := summary[report.StatusSkip].(int64)
skip++
summary["Skip"] = skip
summary[report.StatusSkip] = skip
}
}

View file

@ -4,6 +4,7 @@ import (
"reflect"
"testing"
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
"gotest.tools/assert"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
@ -21,7 +22,7 @@ func Test_mergeClusterReport(t *testing.T) {
"results": []interface{}{
map[string]interface{}{
"policy": "ns-polr-1",
"status": "Pass",
"status": report.StatusPass,
"resources": make([]interface{}, 10),
},
},
@ -37,7 +38,7 @@ func Test_mergeClusterReport(t *testing.T) {
"results": []interface{}{
map[string]interface{}{
"policy": "ns-polr-2",
"status": "Pass",
"status": report.StatusPass,
"resources": make([]interface{}, 5),
},
},
@ -51,7 +52,7 @@ func Test_mergeClusterReport(t *testing.T) {
"results": []interface{}{
map[string]interface{}{
"policy": "polr-3",
"status": "Pass",
"status": report.StatusPass,
"resources": make([]interface{}, 1),
},
},
@ -67,7 +68,7 @@ func Test_mergeClusterReport(t *testing.T) {
"results": []interface{}{
map[string]interface{}{
"policy": "cpolr-4",
"status": "Fail",
"status": report.StatusFail,
},
},
},
@ -82,7 +83,7 @@ func Test_mergeClusterReport(t *testing.T) {
"results": []interface{}{
map[string]interface{}{
"policy": "cpolr-5",
"status": "Fail",
"status": report.StatusFail,
},
},
},
@ -92,21 +93,21 @@ func Test_mergeClusterReport(t *testing.T) {
expectedResults := []interface{}{
map[string]interface{}{
"policy": "ns-polr-2",
"status": "Pass",
"status": report.StatusPass,
"resources": make([]interface{}, 5),
},
map[string]interface{}{
"policy": "polr-3",
"status": "Pass",
"status": report.StatusPass,
"resources": make([]interface{}, 1),
},
map[string]interface{}{
"policy": "cpolr-4",
"status": "Fail",
"status": report.StatusFail,
},
map[string]interface{}{
"policy": "cpolr-5",
"status": "Fail",
"status": report.StatusFail,
},
}
@ -123,28 +124,28 @@ func Test_mergeClusterReport(t *testing.T) {
summary, _, err := unstructured.NestedMap(cpolr.UnstructuredContent(), "summary")
assert.NilError(t, err)
assert.Assert(t, summary["Pass"].(int64) == 6, summary["Pass"])
assert.Assert(t, summary["Fail"].(int64) == 2, summary["Fail"])
assert.Assert(t, summary[report.StatusPass].(int64) == 6, summary[report.StatusPass])
assert.Assert(t, summary[report.StatusFail].(int64) == 2, summary[report.StatusFail])
}
func Test_updateSummary(t *testing.T) {
results := []interface{}{
map[string]interface{}{
"status": "Pass",
"status": report.StatusPass,
"resources": make([]interface{}, 5),
},
map[string]interface{}{
"status": "Fail",
"status": report.StatusFail,
},
map[string]interface{}{
"status": "Fail",
"status": report.StatusFail,
},
map[string]interface{}{
"status": "Fail",
"status": report.StatusFail,
},
}
summary := updateSummary(results)
assert.Assert(t, summary["Pass"].(int64) == 5, summary["Pass"])
assert.Assert(t, summary["Fail"].(int64) == 3, summary["Fail"])
assert.Assert(t, summary[report.StatusPass].(int64) == 5, summary[report.StatusPass])
assert.Assert(t, summary[report.StatusFail].(int64) == 3, summary[report.StatusFail])
}

View file

@ -4,6 +4,7 @@ import (
"os"
"testing"
preport "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
"github.com/kyverno/kyverno/pkg/common"
"github.com/kyverno/kyverno/pkg/engine/response"
@ -75,15 +76,15 @@ func Test_buildPolicyReports(t *testing.T) {
assert.Assert(t, report.GetKind() == "ClusterPolicyReport")
assert.Assert(t, len(report.UnstructuredContent()["results"].([]interface{})) == 2)
assert.Assert(t,
report.UnstructuredContent()["summary"].(map[string]interface{})["Pass"].(int64) == 1,
report.UnstructuredContent()["summary"].(map[string]interface{})["Pass"].(int64))
report.UnstructuredContent()["summary"].(map[string]interface{})[preport.StatusPass].(int64) == 1,
report.UnstructuredContent()["summary"].(map[string]interface{})[preport.StatusPass].(int64))
} else {
assert.Assert(t, report.GetName() == "policyreport-ns-policy1-namespace")
assert.Assert(t, report.GetKind() == "PolicyReport")
assert.Assert(t, len(report.UnstructuredContent()["results"].([]interface{})) == 2)
assert.Assert(t,
report.UnstructuredContent()["summary"].(map[string]interface{})["Pass"].(int64) == 1,
report.UnstructuredContent()["summary"].(map[string]interface{})["Pass"].(int64))
report.UnstructuredContent()["summary"].(map[string]interface{})[preport.StatusPass].(int64) == 1,
report.UnstructuredContent()["summary"].(map[string]interface{})[preport.StatusPass].(int64))
}
}
}
@ -100,156 +101,29 @@ func Test_buildPolicyResults(t *testing.T) {
for _, r := range result {
switch r.Rule {
case "policy1-rule1", "clusterpolicy2-rule1":
assert.Assert(t, r.Status == report.PolicyStatus("Pass"))
assert.Assert(t, r.Status == report.PolicyStatus(preport.StatusPass))
case "policy1-rule2", "clusterpolicy2-rule2":
assert.Assert(t, r.Status == report.PolicyStatus("Fail"))
assert.Assert(t, r.Status == report.PolicyStatus(preport.StatusFail))
}
}
}
}
func Test_mergeSucceededResults(t *testing.T) {
resultsMap := map[string][]*report.PolicyReportResult{
clusterpolicyreport: {
{
Status: report.PolicyStatus("Pass"),
Policy: "clusterpolicy",
Rule: "clusterrule",
Resources: []*v1.ObjectReference{
{
Name: "cluster-resource-1",
},
{
Name: "cluster-resource-2",
},
},
},
{
Status: report.PolicyStatus("Pass"),
Policy: "clusterpolicy",
Rule: "clusterrule",
Resources: []*v1.ObjectReference{
{
Name: "cluster-resource-3",
},
{
Name: "cluster-resource-4",
},
},
},
{
Status: report.PolicyStatus("Fail"),
Policy: "clusterpolicy",
Rule: "clusterrule",
Resources: []*v1.ObjectReference{
{
Name: "cluster-resource-5",
},
},
},
},
"policyreport-ns-test1": {
{
Status: report.PolicyStatus("Pass"),
Policy: "test1-policy",
Rule: "test1-rule",
Resources: []*v1.ObjectReference{
{
Name: "resource-1",
},
{
Name: "resource-2",
},
},
},
{
Status: report.PolicyStatus("Pass"),
Policy: "test1-policy",
Rule: "test1-rule",
Resources: []*v1.ObjectReference{
{
Name: "resource-3",
},
{
Name: "resource-4",
},
},
},
{
Status: report.PolicyStatus("Fail"),
Policy: "test1-policy",
Rule: "test1-rule",
Resources: []*v1.ObjectReference{
{
Name: "resource-5",
},
},
},
},
"policyreport-ns-test2": {
{
Status: report.PolicyStatus("Pass"),
Policy: "test2-policy",
Rule: "test2-rule",
Resources: []*v1.ObjectReference{
{
Name: "resource-1",
},
{
Name: "resource-2",
},
},
},
},
}
results := mergeSucceededResults(resultsMap)
assert.Assert(t, len(results) == len(resultsMap), len(results), len(resultsMap))
for key, result := range results {
if key == clusterpolicyreport {
assert.Assert(t, len(result) == 3, len(result))
for _, res := range result {
if res.Status == report.PolicyStatus("Pass") {
assert.Assert(t, len(res.Resources) == 2, len(res.Resources))
} else {
assert.Assert(t, len(res.Resources) == 1, len(res.Resources))
}
}
}
if key == "policyreport-ns-test1" {
assert.Assert(t, len(result) == 3, len(result))
for _, res := range result {
if res.Status == report.PolicyStatus("Pass") {
assert.Assert(t, len(res.Resources) == 2, len(res.Resources))
} else {
assert.Assert(t, len(res.Resources) == 1, len(res.Resources))
}
}
}
if key == "policyreport-ns-test2" {
assert.Assert(t, len(result[0].Resources) == 2, len(result[0].Resources))
}
}
}
func Test_calculateSummary(t *testing.T) {
results := []*report.PolicyReportResult{
{
Resources: make([]*v1.ObjectReference, 5),
Status: report.PolicyStatus("Pass"),
Status: report.PolicyStatus(preport.StatusPass),
},
{Status: report.PolicyStatus("Fail")},
{Status: report.PolicyStatus("Fail")},
{Status: report.PolicyStatus("Fail")},
{Status: report.PolicyStatus(preport.StatusFail)},
{Status: report.PolicyStatus(preport.StatusFail)},
{Status: report.PolicyStatus(preport.StatusFail)},
{
Resources: make([]*v1.ObjectReference, 1),
Status: report.PolicyStatus("Pass")},
Status: report.PolicyStatus(preport.StatusPass)},
{
Resources: make([]*v1.ObjectReference, 4),
Status: report.PolicyStatus("Pass"),
Status: report.PolicyStatus(preport.StatusPass),
},
}

View file

@ -88,6 +88,7 @@ func (pvb *requestBuilder) build(info Info) (req *unstructured.Unstructured, err
result.Rule = rule.Name
result.Message = rule.Message
result.Status = report.PolicyStatus(rule.Check)
fmt.Println("======status", result.Status)
results = append(results, result)
}