1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/pkg/utils/report/config.go
Vishal Choudhary ec546e6fb4
feat: add helm configuration for reporting in different rules (#11376)
* 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>
2024-10-11 09:42:29 +00:00

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
}