1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

644 removing more deadcode related to previous commit

This commit is contained in:
shravan 2020-02-03 18:58:31 +05:30
parent 0d4b256d13
commit 4471117d42

View file

@ -1,50 +1,44 @@
package namespace
import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
v1CoreLister "k8s.io/client-go/listers/core/v1"
)
//NamespaceListerExpansion ...
type NamespaceListerExpansion interface {
v1CoreLister.NamespaceLister
// List lists all Namespaces in the indexer.
ListResources(selector labels.Selector) (ret []*v1.Namespace, err error)
// GetsResource and injects gvk
GetResource(name string) (*v1.Namespace, error)
}
//NamespaceLister ...
type NamespaceLister struct {
v1CoreLister.NamespaceLister
}
//NewNamespaceLister returns a new NamespaceLister
func NewNamespaceLister(nsLister v1CoreLister.NamespaceLister) NamespaceListerExpansion {
nsl := NamespaceLister{
nsLister,
}
return &nsl
}
//ListResources is a wrapper to List and adds the resource kind information
// as the lister is specific to a gvk we can harcode the values here
func (nsl *NamespaceLister) ListResources(selector labels.Selector) (ret []*v1.Namespace, err error) {
namespaces, err := nsl.List(selector)
for index := range namespaces {
namespaces[index].SetGroupVersionKind(v1.SchemeGroupVersion.WithKind("Namespace"))
}
return namespaces, err
}
//GetResource is a wrapper to get the resource and inject the GVK
func (nsl *NamespaceLister) GetResource(name string) (*v1.Namespace, error) {
namespace, err := nsl.Get(name)
if err != nil {
return nil, err
}
namespace.SetGroupVersionKind(v1.SchemeGroupVersion.WithKind("Namespace"))
return namespace, err
}
////NamespaceListerExpansion ...
//type NamespaceListerExpansion interface {
// v1CoreLister.NamespaceLister
// // List lists all Namespaces in the indexer.
// ListResources(selector labels.Selector) (ret []*v1.Namespace, err error)
// // GetsResource and injects gvk
// GetResource(name string) (*v1.Namespace, error)
//}
//
////NamespaceLister ...
//type NamespaceLister struct {
// v1CoreLister.NamespaceLister
//}
//
////NewNamespaceLister returns a new NamespaceLister
//func NewNamespaceLister(nsLister v1CoreLister.NamespaceLister) NamespaceListerExpansion {
// nsl := NamespaceLister{
// nsLister,
// }
// return &nsl
//}
//
////ListResources is a wrapper to List and adds the resource kind information
//// as the lister is specific to a gvk we can harcode the values here
//func (nsl *NamespaceLister) ListResources(selector labels.Selector) (ret []*v1.Namespace, err error) {
// namespaces, err := nsl.List(selector)
// for index := range namespaces {
// namespaces[index].SetGroupVersionKind(v1.SchemeGroupVersion.WithKind("Namespace"))
// }
// return namespaces, err
//}
//
////GetResource is a wrapper to get the resource and inject the GVK
//func (nsl *NamespaceLister) GetResource(name string) (*v1.Namespace, error) {
// namespace, err := nsl.Get(name)
// if err != nil {
// return nil, err
// }
//
// namespace.SetGroupVersionKind(v1.SchemeGroupVersion.WithKind("Namespace"))
// return namespace, err
//}