// ListResourceUsingInformerFunc returns a listing function based on the shared informer factory for the specified resource. func ListResourceUsingInformerFunc(f informers.SharedInformerFactory, groupResource unversioned.GroupResource) ListFuncByNamespace { return func(namespace string, options api.ListOptions) ([]runtime.Object, error) { informer, err := f.ForResource(groupResource) if err != nil { return nil, err } return informer.Lister().ByNamespace(namespace).List(options.LabelSelector) } }
// controllerFor returns a replenishment controller for the specified group resource. func controllerFor( groupResource schema.GroupResource, f informers.SharedInformerFactory, handlerFuncs cache.ResourceEventHandlerFuncs) (cache.ControllerInterface, error) { genericInformer, err := f.ForResource(groupResource) if err != nil { return nil, err } informer := genericInformer.Informer() informer.AddEventHandler(handlerFuncs) return informer.GetController(), nil }
// ListResourceUsingInformerFunc returns a listing function based on the shared informer factory for the specified resource. func ListResourceUsingInformerFunc(f informers.SharedInformerFactory, groupResource schema.GroupResource) ListFuncByNamespace { return func(namespace string, options v1.ListOptions) ([]runtime.Object, error) { labelSelector, err := labels.Parse(options.LabelSelector) if err != nil { return nil, err } informer, err := f.ForResource(groupResource) if err != nil { return nil, err } return informer.Lister().ByNamespace(namespace).List(labelSelector) } }
func (p *podNodeSelector) SetInformerFactory(f informers.SharedInformerFactory) { p.namespaceInformer = f.InternalNamespaces().Informer() p.SetReadyFunc(p.namespaceInformer.HasSynced) }
func (p *provision) SetInformerFactory(f informers.SharedInformerFactory) { p.namespaceInformer = f.Namespaces().Informer() p.SetReadyFunc(p.namespaceInformer.HasSynced) }
func (l *limitRanger) SetInformerFactory(f informers.SharedInformerFactory) { limitRangeInformer := f.InternalLimitRanges().Informer() l.SetReadyFunc(limitRangeInformer.HasSynced) l.lister = f.InternalLimitRanges().Lister() }
func (e *exists) SetInformerFactory(f informers.SharedInformerFactory) { e.namespaceInformer = f.InternalNamespaces().Informer() e.SetReadyFunc(e.namespaceInformer.HasSynced) }
func (l *lifecycle) SetInformerFactory(f informers.SharedInformerFactory) { l.namespaceInformer = f.Namespaces().Informer() l.SetReadyFunc(l.namespaceInformer.HasSynced) }