mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-02-07 14:22:51 +08:00
Run hack/update-codegen.sh informers subprojects
Signed-off-by: Eric Lin <exlin@google.com> Kubernetes-commit: c86f562f29b6b7498ea962d2ac596e6d26ecd723
This commit is contained in:
parent
c29829f9e6
commit
bb27c732c3
@ -42,6 +42,7 @@ type sharedInformerFactory struct {
|
|||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
defaultResync time.Duration
|
defaultResync time.Duration
|
||||||
customResync map[reflect.Type]time.Duration
|
customResync map[reflect.Type]time.Duration
|
||||||
|
transform cache.TransformFunc
|
||||||
|
|
||||||
informers map[reflect.Type]cache.SharedIndexInformer
|
informers map[reflect.Type]cache.SharedIndexInformer
|
||||||
// startedInformers is used for tracking which informers have been started.
|
// startedInformers is used for tracking which informers have been started.
|
||||||
@ -80,6 +81,14 @@ func WithNamespace(namespace string) SharedInformerOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithTransform sets a transform on all informers.
|
||||||
|
func WithTransform(transform cache.TransformFunc) SharedInformerOption {
|
||||||
|
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||||
|
factory.transform = transform
|
||||||
|
return factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
|
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
|
||||||
func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
|
func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
|
||||||
return NewSharedInformerFactoryWithOptions(client, defaultResync)
|
return NewSharedInformerFactoryWithOptions(client, defaultResync)
|
||||||
@ -184,6 +193,7 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
|
|||||||
}
|
}
|
||||||
|
|
||||||
informer = newFunc(f.client, resyncPeriod)
|
informer = newFunc(f.client, resyncPeriod)
|
||||||
|
informer.SetTransform(f.transform)
|
||||||
f.informers[informerType] = informer
|
f.informers[informerType] = informer
|
||||||
|
|
||||||
return informer
|
return informer
|
||||||
|
Loading…
Reference in New Issue
Block a user