Re-generate informers

Kubernetes-commit: 37f909a274df25e2574cbc6a92f7a9991d1948ce
This commit is contained in:
Mikhail Mazurskiy
2017-07-25 12:19:17 +10:00
committed by Kubernetes Publisher
parent a2643f9d58
commit 953296ece8
48 changed files with 544 additions and 304 deletions

View File

@@ -41,26 +41,31 @@ type replicaSetInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newReplicaSetInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
// NewReplicaSetInformer constructs a new informer for ReplicaSet 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 NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.ExtensionsV1beta1().ReplicaSets(v1.NamespaceAll).List(options)
return client.ExtensionsV1beta1().ReplicaSets(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.ExtensionsV1beta1().ReplicaSets(v1.NamespaceAll).Watch(options)
return client.ExtensionsV1beta1().ReplicaSets(namespace).Watch(options)
},
},
&extensions_v1beta1.ReplicaSet{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
indexers,
)
}
return sharedIndexInformer
func defaultReplicaSetInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewReplicaSetInformer(client, v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
}
func (f *replicaSetInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&extensions_v1beta1.ReplicaSet{}, newReplicaSetInformer)
return f.factory.InformerFor(&extensions_v1beta1.ReplicaSet{}, defaultReplicaSetInformer)
}
func (f *replicaSetInformer) Lister() v1beta1.ReplicaSetLister {