mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-23 12:07:05 +00:00
Re-generate informers
Kubernetes-commit: 37f909a274df25e2574cbc6a92f7a9991d1948ce
This commit is contained in:
committed by
Kubernetes Publisher
parent
a2643f9d58
commit
953296ece8
@@ -41,26 +41,31 @@ type endpointsInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newEndpointsInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
// NewEndpointsInformer constructs a new informer for Endpoints 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 NewEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
|
||||
return client.CoreV1().Endpoints(meta_v1.NamespaceAll).List(options)
|
||||
return client.CoreV1().Endpoints(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||
return client.CoreV1().Endpoints(meta_v1.NamespaceAll).Watch(options)
|
||||
return client.CoreV1().Endpoints(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&core_v1.Endpoints{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
return sharedIndexInformer
|
||||
func defaultEndpointsInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewEndpointsInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
||||
}
|
||||
|
||||
func (f *endpointsInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&core_v1.Endpoints{}, newEndpointsInformer)
|
||||
return f.factory.InformerFor(&core_v1.Endpoints{}, defaultEndpointsInformer)
|
||||
}
|
||||
|
||||
func (f *endpointsInformer) Lister() v1.EndpointsLister {
|
||||
|
Reference in New Issue
Block a user