mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-23 20:17:15 +00:00
run hack/update-codegen.sh
Kubernetes-commit: 6a4b80fcabc5e950af997d97f447354b83fcdcc4
This commit is contained in:
committed by
Kubernetes Publisher
parent
d017730688
commit
a6812b3f80
@@ -38,19 +38,34 @@ type ServiceInformer interface {
|
||||
}
|
||||
|
||||
type serviceInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewServiceInformer constructs a new informer for Service 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 NewServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredServiceInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredServiceInformer constructs a new informer for Service 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 NewFilteredServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.CoreV1().Services(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.CoreV1().Services(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
@@ -60,12 +75,12 @@ func NewServiceInformer(client kubernetes.Interface, namespace string, resyncPer
|
||||
)
|
||||
}
|
||||
|
||||
func defaultServiceInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewServiceInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
||||
func (f *serviceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *serviceInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&core_v1.Service{}, defaultServiceInformer)
|
||||
return f.factory.InformerFor(&core_v1.Service{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *serviceInformer) Lister() v1.ServiceLister {
|
||||
|
Reference in New Issue
Block a user