1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 23:46:56 +00:00
kyverno/cmd/cli/kubectl-kyverno/policy/annotations/annotations.go
Charles-Edouard Brétéché 90d84d81b2
refactor: cli packages structure (#8254)
* refactor: cli packages structure

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix: unit tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 17:04:10 +00:00

22 lines
666 B
Go

package annotations
import (
"github.com/kyverno/kyverno/api/kyverno"
policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
reportutils "github.com/kyverno/kyverno/pkg/utils/report"
)
func Scored(annotations map[string]string) bool {
if scored, ok := annotations[kyverno.AnnotationPolicyScored]; ok && scored == "false" {
return false
}
return true
}
func Severity(annotations map[string]string) policyreportv1alpha2.PolicySeverity {
return reportutils.SeverityFromString(annotations[kyverno.AnnotationPolicySeverity])
}
func Category(annotations map[string]string) string {
return annotations[kyverno.AnnotationPolicyCategory]
}