1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00
kyverno/pkg/utils/controller/selector.go
Charles-Edouard Brétéché 03702476fa
refactor: move kyverno constants out of v1 package (#7760)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-07-06 08:00:36 +00:00

16 lines
450 B
Go

package controller
import (
"github.com/kyverno/kyverno/api/kyverno"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection"
)
func SelectorNotManagedByKyverno() (labels.Selector, error) {
selector := labels.Everything()
requirement, err := labels.NewRequirement(kyverno.LabelAppManagedBy, selection.NotEquals, []string{kyverno.ValueKyvernoApp})
if err == nil {
selector = selector.Add(*requirement)
}
return selector, err
}