func ContainsNamepace(patterns []string, ns string) bool {
	return contains(patterns, ns, compareNamespaces)
}
ContainsNamepace check if namespace satisfies any list of pattern(regex)
package utils
import (
	"encoding/json"
	"fmt"
	"regexp"
	"strconv"
	"sigs.k8s.io/controller-runtime/pkg/log"
	"github.com/go-logr/logr"
	kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
	common "github.com/kyverno/kyverno/pkg/common"
	client "github.com/kyverno/kyverno/pkg/dclient"
	engineutils "github.com/kyverno/kyverno/pkg/engine/utils"
	"github.com/minio/pkg/wildcard"
	"k8s.io/api/admission/v1beta1"
	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
)
var regexVersion = regexp.MustCompile(`v(\d+).(\d+).(\d+)\.*`)
func contains(list []string, element string, fn func(string, string) bool) bool {
	for _, e := range list {
		if fn(e, element) {
			return true
		}
	}
	return false
}
func ContainsPod(list []string, element string) bool {
	for _, e := range list {
		_, k := common.GetKindFromGVK(e)
		if k == element {
			return true
		}
	}
	return false
}