mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-07 01:50:46 +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 jobInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newJobInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
// NewJobInformer constructs a new informer for Job 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 NewJobInformer(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.BatchV1().Jobs(meta_v1.NamespaceAll).List(options)
|
||||
return client.BatchV1().Jobs(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||
return client.BatchV1().Jobs(meta_v1.NamespaceAll).Watch(options)
|
||||
return client.BatchV1().Jobs(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&batch_v1.Job{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
return sharedIndexInformer
|
||||
func defaultJobInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewJobInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
||||
}
|
||||
|
||||
func (f *jobInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&batch_v1.Job{}, newJobInformer)
|
||||
return f.factory.InformerFor(&batch_v1.Job{}, defaultJobInformer)
|
||||
}
|
||||
|
||||
func (f *jobInformer) Lister() v1.JobLister {
|
||||
|
@@ -41,26 +41,31 @@ type cronJobInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newCronJobInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
// NewCronJobInformer constructs a new informer for CronJob 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 NewCronJobInformer(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.BatchV2alpha1().CronJobs(v1.NamespaceAll).List(options)
|
||||
return client.BatchV2alpha1().CronJobs(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
return client.BatchV2alpha1().CronJobs(v1.NamespaceAll).Watch(options)
|
||||
return client.BatchV2alpha1().CronJobs(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&batch_v2alpha1.CronJob{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
return sharedIndexInformer
|
||||
func defaultCronJobInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewCronJobInformer(client, v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
||||
}
|
||||
|
||||
func (f *cronJobInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&batch_v2alpha1.CronJob{}, newCronJobInformer)
|
||||
return f.factory.InformerFor(&batch_v2alpha1.CronJob{}, defaultCronJobInformer)
|
||||
}
|
||||
|
||||
func (f *cronJobInformer) Lister() v2alpha1.CronJobLister {
|
||||
|
Reference in New Issue
Block a user