// 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
}
Beispiel #3
0
// 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)
	}
}
Beispiel #4
0
func (p *podNodeSelector) SetInformerFactory(f informers.SharedInformerFactory) {
	p.namespaceInformer = f.InternalNamespaces().Informer()
	p.SetReadyFunc(p.namespaceInformer.HasSynced)
}
Beispiel #5
0
func (p *provision) SetInformerFactory(f informers.SharedInformerFactory) {
	p.namespaceInformer = f.Namespaces().Informer()
	p.SetReadyFunc(p.namespaceInformer.HasSynced)
}
Beispiel #6
0
func (l *limitRanger) SetInformerFactory(f informers.SharedInformerFactory) {
	limitRangeInformer := f.InternalLimitRanges().Informer()
	l.SetReadyFunc(limitRangeInformer.HasSynced)
	l.lister = f.InternalLimitRanges().Lister()
}
Beispiel #7
0
func (e *exists) SetInformerFactory(f informers.SharedInformerFactory) {
	e.namespaceInformer = f.InternalNamespaces().Informer()
	e.SetReadyFunc(e.namespaceInformer.HasSynced)
}
Beispiel #8
0
func (l *lifecycle) SetInformerFactory(f informers.SharedInformerFactory) {
	l.namespaceInformer = f.Namespaces().Informer()
	l.SetReadyFunc(l.namespaceInformer.HasSynced)
}