github.com/castai/kvisor@v1.7.1-0.20240516114728-b3572a2607b5/cmd/controller/state/kubelinter/customobjectkinds/namespace.go (about)

     1  package customobjectkinds
     2  
     3  import (
     4  	"sync"
     5  
     6  	"golang.stackrox.io/kube-linter/pkg/objectkinds"
     7  	corev1 "k8s.io/api/core/v1"
     8  	"k8s.io/apimachinery/pkg/runtime/schema"
     9  )
    10  
    11  const (
    12  	// Namespace represents Kubernetes Namespace objects. Case sensitive.
    13  	Namespace = "Namespace"
    14  )
    15  
    16  var (
    17  	namespaceGVK = corev1.SchemeGroupVersion.WithKind("Namespace")
    18  	once         sync.Once
    19  )
    20  
    21  func RegisterNamespaceKind() {
    22  	once.Do(func() {
    23  		objectkinds.RegisterObjectKind(Namespace, objectkinds.MatcherFunc(func(gvk schema.GroupVersionKind) bool {
    24  			return gvk == namespaceGVK
    25  		}))
    26  	})
    27  }