mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-10 01:46:55 +00:00
* chore: add unit tests for pkg/utils/wildcard Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> * testify Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
15 lines
330 B
Go
15 lines
330 B
Go
package kube
|
|
|
|
import (
|
|
"github.com/kyverno/kyverno/pkg/utils/wildcard"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
)
|
|
|
|
func LabelSelectorContainsWildcard(v *metav1.LabelSelector) bool {
|
|
for k, v := range v.MatchLabels {
|
|
if wildcard.ContainsWildcard(k) || wildcard.ContainsWildcard(v) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|