mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
* feat: add helm configuration for reporting in different rules (forgot signoff) Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * fix: linter and tests Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> * feat: rename reporting.imageVerification Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> --------- Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com> Signed-off-by: ShutingZhao <shuting@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com>
41 lines
946 B
Go
41 lines
946 B
Go
package report
|
|
|
|
import "k8s.io/apimachinery/pkg/util/sets"
|
|
|
|
type reportingConfig struct {
|
|
helper sets.Set[string]
|
|
}
|
|
|
|
func (r *reportingConfig) ValidateReportsEnabled() bool {
|
|
return r.helper.Has("validate")
|
|
}
|
|
|
|
func (r *reportingConfig) MutateReportsEnabled() bool {
|
|
return r.helper.Has("mutate")
|
|
}
|
|
|
|
func (r *reportingConfig) MutateExistingReportsEnabled() bool {
|
|
return r.helper.Has("mutateExisting")
|
|
}
|
|
|
|
func (r *reportingConfig) ImageVerificationReportsEnabled() bool {
|
|
return r.helper.Has("imageVerify")
|
|
}
|
|
|
|
func (r *reportingConfig) GenerateReportsEnabled() bool {
|
|
return r.helper.Has("generate")
|
|
}
|
|
|
|
func NewReportingConfig(items ...string) ReportingConfiguration {
|
|
return &reportingConfig{
|
|
helper: sets.New(items...),
|
|
}
|
|
}
|
|
|
|
type ReportingConfiguration interface {
|
|
ValidateReportsEnabled() bool
|
|
MutateReportsEnabled() bool
|
|
MutateExistingReportsEnabled() bool
|
|
ImageVerificationReportsEnabled() bool
|
|
GenerateReportsEnabled() bool
|
|
}
|