1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 15:37:19 +00:00
kyverno/pkg/utils/report/support.go
Charles-Edouard Brétéché 47780bf37f
fix: improve banned types management in reports (#4953)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-10-14 23:20:30 +08:00

20 lines
590 B
Go

package report
import (
corev1 "k8s.io/api/core/v1"
eventsv1 "k8s.io/api/events/v1"
eventsv1beta1 "k8s.io/api/events/v1beta1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// bannedOwners are GVKs that are not allowed to be owners of other resources
var bannedOwners = map[schema.GroupVersionKind]struct{}{
corev1.SchemeGroupVersion.WithKind("Event"): {},
eventsv1.SchemeGroupVersion.WithKind("Event"): {},
eventsv1beta1.SchemeGroupVersion.WithKind("Event"): {},
}
func IsGvkSupported(gvk schema.GroupVersionKind) bool {
_, exists := bannedOwners[gvk]
return !exists
}