From 6aaed162db864c58a2932654acdaf4aa05bf774a Mon Sep 17 00:00:00 2001 From: Mir Shahriar Date: Fri, 20 Apr 2018 21:25:12 +0600 Subject: [PATCH] Generate non-namespaced client for plugins (#355) --- apis/monitoring/v1alpha1/plugin.go | 1 + .../v1alpha1/fake/fake_monitoring_client.go | 4 +- .../v1alpha1/fake/fake_searchlightplugin.go | 24 ++++-------- .../monitoring/v1alpha1/monitoring_client.go | 4 +- .../monitoring/v1alpha1/searchlightplugin.go | 14 +------ .../util/{plugin.go => searchlightplugin.go} | 10 ++--- .../monitoring/v1alpha1/interface.go | 2 +- .../monitoring/v1alpha1/searchlightplugin.go | 13 +++---- .../v1alpha1/expansion_generated.go | 4 -- .../monitoring/v1alpha1/searchlightplugin.go | 39 +++---------------- 10 files changed, 32 insertions(+), 83 deletions(-) rename client/clientset/versioned/typed/monitoring/v1alpha1/util/{plugin.go => searchlightplugin.go} (86%) diff --git a/apis/monitoring/v1alpha1/plugin.go b/apis/monitoring/v1alpha1/plugin.go index 6cee8b1ea..f7c28334c 100644 --- a/apis/monitoring/v1alpha1/plugin.go +++ b/apis/monitoring/v1alpha1/plugin.go @@ -11,6 +11,7 @@ const ( ) // +genclient +// +genclient:nonNamespaced // +genclient:skipVerbs=updateStatus // +k8s:openapi-gen=true // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/client/clientset/versioned/typed/monitoring/v1alpha1/fake/fake_monitoring_client.go b/client/clientset/versioned/typed/monitoring/v1alpha1/fake/fake_monitoring_client.go index 05c01619f..ed69c3d09 100644 --- a/client/clientset/versioned/typed/monitoring/v1alpha1/fake/fake_monitoring_client.go +++ b/client/clientset/versioned/typed/monitoring/v1alpha1/fake/fake_monitoring_client.go @@ -42,8 +42,8 @@ func (c *FakeMonitoringV1alpha1) PodAlerts(namespace string) v1alpha1.PodAlertIn return &FakePodAlerts{c, namespace} } -func (c *FakeMonitoringV1alpha1) SearchlightPlugins(namespace string) v1alpha1.SearchlightPluginInterface { - return &FakeSearchlightPlugins{c, namespace} +func (c *FakeMonitoringV1alpha1) SearchlightPlugins() v1alpha1.SearchlightPluginInterface { + return &FakeSearchlightPlugins{c} } // RESTClient returns a RESTClient that is used to communicate diff --git a/client/clientset/versioned/typed/monitoring/v1alpha1/fake/fake_searchlightplugin.go b/client/clientset/versioned/typed/monitoring/v1alpha1/fake/fake_searchlightplugin.go index 791b2297f..f4378b534 100644 --- a/client/clientset/versioned/typed/monitoring/v1alpha1/fake/fake_searchlightplugin.go +++ b/client/clientset/versioned/typed/monitoring/v1alpha1/fake/fake_searchlightplugin.go @@ -29,7 +29,6 @@ import ( // FakeSearchlightPlugins implements SearchlightPluginInterface type FakeSearchlightPlugins struct { Fake *FakeMonitoringV1alpha1 - ns string } var searchlightpluginsResource = schema.GroupVersionResource{Group: "monitoring.appscode.com", Version: "v1alpha1", Resource: "searchlightplugins"} @@ -39,8 +38,7 @@ var searchlightpluginsKind = schema.GroupVersionKind{Group: "monitoring.appscode // Get takes name of the searchlightPlugin, and returns the corresponding searchlightPlugin object, and an error if there is any. func (c *FakeSearchlightPlugins) Get(name string, options v1.GetOptions) (result *v1alpha1.SearchlightPlugin, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(searchlightpluginsResource, c.ns, name), &v1alpha1.SearchlightPlugin{}) - + Invokes(testing.NewRootGetAction(searchlightpluginsResource, name), &v1alpha1.SearchlightPlugin{}) if obj == nil { return nil, err } @@ -50,8 +48,7 @@ func (c *FakeSearchlightPlugins) Get(name string, options v1.GetOptions) (result // List takes label and field selectors, and returns the list of SearchlightPlugins that match those selectors. func (c *FakeSearchlightPlugins) List(opts v1.ListOptions) (result *v1alpha1.SearchlightPluginList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(searchlightpluginsResource, searchlightpluginsKind, c.ns, opts), &v1alpha1.SearchlightPluginList{}) - + Invokes(testing.NewRootListAction(searchlightpluginsResource, searchlightpluginsKind, opts), &v1alpha1.SearchlightPluginList{}) if obj == nil { return nil, err } @@ -72,15 +69,13 @@ func (c *FakeSearchlightPlugins) List(opts v1.ListOptions) (result *v1alpha1.Sea // Watch returns a watch.Interface that watches the requested searchlightPlugins. func (c *FakeSearchlightPlugins) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(searchlightpluginsResource, c.ns, opts)) - + InvokesWatch(testing.NewRootWatchAction(searchlightpluginsResource, opts)) } // Create takes the representation of a searchlightPlugin and creates it. Returns the server's representation of the searchlightPlugin, and an error, if there is any. func (c *FakeSearchlightPlugins) Create(searchlightPlugin *v1alpha1.SearchlightPlugin) (result *v1alpha1.SearchlightPlugin, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(searchlightpluginsResource, c.ns, searchlightPlugin), &v1alpha1.SearchlightPlugin{}) - + Invokes(testing.NewRootCreateAction(searchlightpluginsResource, searchlightPlugin), &v1alpha1.SearchlightPlugin{}) if obj == nil { return nil, err } @@ -90,8 +85,7 @@ func (c *FakeSearchlightPlugins) Create(searchlightPlugin *v1alpha1.SearchlightP // Update takes the representation of a searchlightPlugin and updates it. Returns the server's representation of the searchlightPlugin, and an error, if there is any. func (c *FakeSearchlightPlugins) Update(searchlightPlugin *v1alpha1.SearchlightPlugin) (result *v1alpha1.SearchlightPlugin, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(searchlightpluginsResource, c.ns, searchlightPlugin), &v1alpha1.SearchlightPlugin{}) - + Invokes(testing.NewRootUpdateAction(searchlightpluginsResource, searchlightPlugin), &v1alpha1.SearchlightPlugin{}) if obj == nil { return nil, err } @@ -101,14 +95,13 @@ func (c *FakeSearchlightPlugins) Update(searchlightPlugin *v1alpha1.SearchlightP // Delete takes name of the searchlightPlugin and deletes it. Returns an error if one occurs. func (c *FakeSearchlightPlugins) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(searchlightpluginsResource, c.ns, name), &v1alpha1.SearchlightPlugin{}) - + Invokes(testing.NewRootDeleteAction(searchlightpluginsResource, name), &v1alpha1.SearchlightPlugin{}) return err } // DeleteCollection deletes a collection of objects. func (c *FakeSearchlightPlugins) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(searchlightpluginsResource, c.ns, listOptions) + action := testing.NewRootDeleteCollectionAction(searchlightpluginsResource, listOptions) _, err := c.Fake.Invokes(action, &v1alpha1.SearchlightPluginList{}) return err @@ -117,8 +110,7 @@ func (c *FakeSearchlightPlugins) DeleteCollection(options *v1.DeleteOptions, lis // Patch applies the patch and returns the patched searchlightPlugin. func (c *FakeSearchlightPlugins) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.SearchlightPlugin, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(searchlightpluginsResource, c.ns, name, data, subresources...), &v1alpha1.SearchlightPlugin{}) - + Invokes(testing.NewRootPatchSubresourceAction(searchlightpluginsResource, name, data, subresources...), &v1alpha1.SearchlightPlugin{}) if obj == nil { return nil, err } diff --git a/client/clientset/versioned/typed/monitoring/v1alpha1/monitoring_client.go b/client/clientset/versioned/typed/monitoring/v1alpha1/monitoring_client.go index 327d1ad21..3eec5f005 100644 --- a/client/clientset/versioned/typed/monitoring/v1alpha1/monitoring_client.go +++ b/client/clientset/versioned/typed/monitoring/v1alpha1/monitoring_client.go @@ -53,8 +53,8 @@ func (c *MonitoringV1alpha1Client) PodAlerts(namespace string) PodAlertInterface return newPodAlerts(c, namespace) } -func (c *MonitoringV1alpha1Client) SearchlightPlugins(namespace string) SearchlightPluginInterface { - return newSearchlightPlugins(c, namespace) +func (c *MonitoringV1alpha1Client) SearchlightPlugins() SearchlightPluginInterface { + return newSearchlightPlugins(c) } // NewForConfig creates a new MonitoringV1alpha1Client for the given config. diff --git a/client/clientset/versioned/typed/monitoring/v1alpha1/searchlightplugin.go b/client/clientset/versioned/typed/monitoring/v1alpha1/searchlightplugin.go index d2cc091de..b37a058dd 100644 --- a/client/clientset/versioned/typed/monitoring/v1alpha1/searchlightplugin.go +++ b/client/clientset/versioned/typed/monitoring/v1alpha1/searchlightplugin.go @@ -28,7 +28,7 @@ import ( // SearchlightPluginsGetter has a method to return a SearchlightPluginInterface. // A group's client should implement this interface. type SearchlightPluginsGetter interface { - SearchlightPlugins(namespace string) SearchlightPluginInterface + SearchlightPlugins() SearchlightPluginInterface } // SearchlightPluginInterface has methods to work with SearchlightPlugin resources. @@ -47,14 +47,12 @@ type SearchlightPluginInterface interface { // searchlightPlugins implements SearchlightPluginInterface type searchlightPlugins struct { client rest.Interface - ns string } // newSearchlightPlugins returns a SearchlightPlugins -func newSearchlightPlugins(c *MonitoringV1alpha1Client, namespace string) *searchlightPlugins { +func newSearchlightPlugins(c *MonitoringV1alpha1Client) *searchlightPlugins { return &searchlightPlugins{ client: c.RESTClient(), - ns: namespace, } } @@ -62,7 +60,6 @@ func newSearchlightPlugins(c *MonitoringV1alpha1Client, namespace string) *searc func (c *searchlightPlugins) Get(name string, options v1.GetOptions) (result *v1alpha1.SearchlightPlugin, err error) { result = &v1alpha1.SearchlightPlugin{} err = c.client.Get(). - Namespace(c.ns). Resource("searchlightplugins"). Name(name). VersionedParams(&options, scheme.ParameterCodec). @@ -75,7 +72,6 @@ func (c *searchlightPlugins) Get(name string, options v1.GetOptions) (result *v1 func (c *searchlightPlugins) List(opts v1.ListOptions) (result *v1alpha1.SearchlightPluginList, err error) { result = &v1alpha1.SearchlightPluginList{} err = c.client.Get(). - Namespace(c.ns). Resource("searchlightplugins"). VersionedParams(&opts, scheme.ParameterCodec). Do(). @@ -87,7 +83,6 @@ func (c *searchlightPlugins) List(opts v1.ListOptions) (result *v1alpha1.Searchl func (c *searchlightPlugins) Watch(opts v1.ListOptions) (watch.Interface, error) { opts.Watch = true return c.client.Get(). - Namespace(c.ns). Resource("searchlightplugins"). VersionedParams(&opts, scheme.ParameterCodec). Watch() @@ -97,7 +92,6 @@ func (c *searchlightPlugins) Watch(opts v1.ListOptions) (watch.Interface, error) func (c *searchlightPlugins) Create(searchlightPlugin *v1alpha1.SearchlightPlugin) (result *v1alpha1.SearchlightPlugin, err error) { result = &v1alpha1.SearchlightPlugin{} err = c.client.Post(). - Namespace(c.ns). Resource("searchlightplugins"). Body(searchlightPlugin). Do(). @@ -109,7 +103,6 @@ func (c *searchlightPlugins) Create(searchlightPlugin *v1alpha1.SearchlightPlugi func (c *searchlightPlugins) Update(searchlightPlugin *v1alpha1.SearchlightPlugin) (result *v1alpha1.SearchlightPlugin, err error) { result = &v1alpha1.SearchlightPlugin{} err = c.client.Put(). - Namespace(c.ns). Resource("searchlightplugins"). Name(searchlightPlugin.Name). Body(searchlightPlugin). @@ -121,7 +114,6 @@ func (c *searchlightPlugins) Update(searchlightPlugin *v1alpha1.SearchlightPlugi // Delete takes name of the searchlightPlugin and deletes it. Returns an error if one occurs. func (c *searchlightPlugins) Delete(name string, options *v1.DeleteOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("searchlightplugins"). Name(name). Body(options). @@ -132,7 +124,6 @@ func (c *searchlightPlugins) Delete(name string, options *v1.DeleteOptions) erro // DeleteCollection deletes a collection of objects. func (c *searchlightPlugins) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("searchlightplugins"). VersionedParams(&listOptions, scheme.ParameterCodec). Body(options). @@ -144,7 +135,6 @@ func (c *searchlightPlugins) DeleteCollection(options *v1.DeleteOptions, listOpt func (c *searchlightPlugins) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.SearchlightPlugin, err error) { result = &v1alpha1.SearchlightPlugin{} err = c.client.Patch(pt). - Namespace(c.ns). Resource("searchlightplugins"). SubResource(subresources...). Name(name). diff --git a/client/clientset/versioned/typed/monitoring/v1alpha1/util/plugin.go b/client/clientset/versioned/typed/monitoring/v1alpha1/util/searchlightplugin.go similarity index 86% rename from client/clientset/versioned/typed/monitoring/v1alpha1/util/plugin.go rename to client/clientset/versioned/typed/monitoring/v1alpha1/util/searchlightplugin.go index 16a1abc06..6bad12dea 100644 --- a/client/clientset/versioned/typed/monitoring/v1alpha1/util/plugin.go +++ b/client/clientset/versioned/typed/monitoring/v1alpha1/util/searchlightplugin.go @@ -16,10 +16,10 @@ import ( ) func CreateOrPatchSearchlightPlugin(c cs.MonitoringV1alpha1Interface, meta metav1.ObjectMeta, transform func(alert *api.SearchlightPlugin) *api.SearchlightPlugin) (*api.SearchlightPlugin, kutil.VerbType, error) { - cur, err := c.SearchlightPlugins(meta.Namespace).Get(meta.Name, metav1.GetOptions{}) + cur, err := c.SearchlightPlugins().Get(meta.Name, metav1.GetOptions{}) if kerr.IsNotFound(err) { glog.V(3).Infof("Creating SearchlightPlugin %s/%s.", meta.Namespace, meta.Name) - out, err := c.SearchlightPlugins(meta.Namespace).Create(transform(&api.SearchlightPlugin{ + out, err := c.SearchlightPlugins().Create(transform(&api.SearchlightPlugin{ TypeMeta: metav1.TypeMeta{ Kind: "SearchlightPlugin", APIVersion: api.SchemeGroupVersion.String(), @@ -56,7 +56,7 @@ func PatchSearchlightPluginObject(c cs.MonitoringV1alpha1Interface, cur, mod *ap return cur, kutil.VerbUnchanged, nil } glog.V(3).Infof("Patching SearchlightPlugin %s/%s with %s.", cur.Namespace, cur.Name, string(patch)) - out, err := c.SearchlightPlugins(cur.Namespace).Patch(cur.Name, types.MergePatchType, patch) + out, err := c.SearchlightPlugins().Patch(cur.Name, types.MergePatchType, patch) return out, kutil.VerbPatched, err } @@ -64,11 +64,11 @@ func TryUpdateSearchlightPlugin(c cs.MonitoringV1alpha1Interface, meta metav1.Ob attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ - cur, e2 := c.SearchlightPlugins(meta.Namespace).Get(meta.Name, metav1.GetOptions{}) + cur, e2 := c.SearchlightPlugins().Get(meta.Name, metav1.GetOptions{}) if kerr.IsNotFound(e2) { return false, e2 } else if e2 == nil { - result, e2 = c.SearchlightPlugins(cur.Namespace).Update(transform(cur.DeepCopy())) + result, e2 = c.SearchlightPlugins().Update(transform(cur.DeepCopy())) return e2 == nil, nil } glog.Errorf("Attempt %d failed to update SearchlightPlugin %s/%s due to %v.", attempt, cur.Namespace, cur.Name, e2) diff --git a/client/informers/externalversions/monitoring/v1alpha1/interface.go b/client/informers/externalversions/monitoring/v1alpha1/interface.go index 46e7c2933..46fdc5143 100644 --- a/client/informers/externalversions/monitoring/v1alpha1/interface.go +++ b/client/informers/externalversions/monitoring/v1alpha1/interface.go @@ -69,5 +69,5 @@ func (v *version) PodAlerts() PodAlertInformer { // SearchlightPlugins returns a SearchlightPluginInformer. func (v *version) SearchlightPlugins() SearchlightPluginInformer { - return &searchlightPluginInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} + return &searchlightPluginInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/client/informers/externalversions/monitoring/v1alpha1/searchlightplugin.go b/client/informers/externalversions/monitoring/v1alpha1/searchlightplugin.go index faf2c6579..154c1ff5e 100644 --- a/client/informers/externalversions/monitoring/v1alpha1/searchlightplugin.go +++ b/client/informers/externalversions/monitoring/v1alpha1/searchlightplugin.go @@ -41,33 +41,32 @@ type SearchlightPluginInformer interface { type searchlightPluginInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string } // NewSearchlightPluginInformer constructs a new informer for SearchlightPlugin type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewSearchlightPluginInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSearchlightPluginInformer(client, namespace, resyncPeriod, indexers, nil) +func NewSearchlightPluginInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSearchlightPluginInformer(client, resyncPeriod, indexers, nil) } // NewFilteredSearchlightPluginInformer constructs a new informer for SearchlightPlugin type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewFilteredSearchlightPluginInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredSearchlightPluginInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.MonitoringV1alpha1().SearchlightPlugins(namespace).List(options) + return client.MonitoringV1alpha1().SearchlightPlugins().List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.MonitoringV1alpha1().SearchlightPlugins(namespace).Watch(options) + return client.MonitoringV1alpha1().SearchlightPlugins().Watch(options) }, }, &monitoring_v1alpha1.SearchlightPlugin{}, @@ -77,7 +76,7 @@ func NewFilteredSearchlightPluginInformer(client versioned.Interface, namespace } func (f *searchlightPluginInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSearchlightPluginInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewFilteredSearchlightPluginInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *searchlightPluginInformer) Informer() cache.SharedIndexInformer { diff --git a/client/listers/monitoring/v1alpha1/expansion_generated.go b/client/listers/monitoring/v1alpha1/expansion_generated.go index 41bb3a569..6d383e7b2 100644 --- a/client/listers/monitoring/v1alpha1/expansion_generated.go +++ b/client/listers/monitoring/v1alpha1/expansion_generated.go @@ -53,7 +53,3 @@ type PodAlertNamespaceListerExpansion interface{} // SearchlightPluginListerExpansion allows custom methods to be added to // SearchlightPluginLister. type SearchlightPluginListerExpansion interface{} - -// SearchlightPluginNamespaceListerExpansion allows custom methods to be added to -// SearchlightPluginNamespaceLister. -type SearchlightPluginNamespaceListerExpansion interface{} diff --git a/client/listers/monitoring/v1alpha1/searchlightplugin.go b/client/listers/monitoring/v1alpha1/searchlightplugin.go index 3f82f586b..6282af049 100644 --- a/client/listers/monitoring/v1alpha1/searchlightplugin.go +++ b/client/listers/monitoring/v1alpha1/searchlightplugin.go @@ -29,8 +29,8 @@ import ( type SearchlightPluginLister interface { // List lists all SearchlightPlugins in the indexer. List(selector labels.Selector) (ret []*v1alpha1.SearchlightPlugin, err error) - // SearchlightPlugins returns an object that can list and get SearchlightPlugins. - SearchlightPlugins(namespace string) SearchlightPluginNamespaceLister + // Get retrieves the SearchlightPlugin from the index for a given name. + Get(name string) (*v1alpha1.SearchlightPlugin, error) SearchlightPluginListerExpansion } @@ -52,38 +52,9 @@ func (s *searchlightPluginLister) List(selector labels.Selector) (ret []*v1alpha return ret, err } -// SearchlightPlugins returns an object that can list and get SearchlightPlugins. -func (s *searchlightPluginLister) SearchlightPlugins(namespace string) SearchlightPluginNamespaceLister { - return searchlightPluginNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// SearchlightPluginNamespaceLister helps list and get SearchlightPlugins. -type SearchlightPluginNamespaceLister interface { - // List lists all SearchlightPlugins in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha1.SearchlightPlugin, err error) - // Get retrieves the SearchlightPlugin from the indexer for a given namespace and name. - Get(name string) (*v1alpha1.SearchlightPlugin, error) - SearchlightPluginNamespaceListerExpansion -} - -// searchlightPluginNamespaceLister implements the SearchlightPluginNamespaceLister -// interface. -type searchlightPluginNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all SearchlightPlugins in the indexer for a given namespace. -func (s searchlightPluginNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SearchlightPlugin, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.SearchlightPlugin)) - }) - return ret, err -} - -// Get retrieves the SearchlightPlugin from the indexer for a given namespace and name. -func (s searchlightPluginNamespaceLister) Get(name string) (*v1alpha1.SearchlightPlugin, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) +// Get retrieves the SearchlightPlugin from the index for a given name. +func (s *searchlightPluginLister) Get(name string) (*v1alpha1.SearchlightPlugin, error) { + obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err }