Skip to content

Commit 74439c2

Browse files
committed
Update informer generation with kubernetes/kubernetes@9c4651b
Signed-off-by: Marvin Beckers <[email protected]>
1 parent f988763 commit 74439c2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/internal/informergen/factory.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ type SharedInformerOption func(*SharedInformerOptions) *SharedInformerOptions
104104
type SharedInformerOptions struct {
105105
customResync map[reflect.Type]time.Duration
106106
tweakListOptions internalinterfaces.TweakListOptionsFunc
107+
transform cache.TransformFunc
107108
{{if not .useUpstreamInterfaces -}}
108109
namespace string
109110
{{end -}}
@@ -115,6 +116,7 @@ type sharedInformerFactory struct {
115116
lock sync.Mutex
116117
defaultResync time.Duration
117118
customResync map[reflect.Type]time.Duration
119+
transform cache.TransformFunc
118120
119121
informers map[reflect.Type]kcpcache.ScopeableSharedIndexInformer
120122
// startedInformers is used for tracking which informers have been started.
@@ -145,6 +147,14 @@ func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFu
145147
}
146148
}
147149
150+
// WithTransform sets a transform on all informers.
151+
func WithTransform(transform cache.TransformFunc) SharedInformerOption {
152+
return func(opts *SharedInformerOptions) *SharedInformerOptions {
153+
opts.transform = transform
154+
return opts
155+
}
156+
}
157+
148158
// NewSharedInformerFactory constructs a new instance of SharedInformerFactory for all namespaces.
149159
func NewSharedInformerFactory(client clientset.ClusterInterface, defaultResync time.Duration) SharedInformerFactory {
150160
return NewSharedInformerFactoryWithOptions(client, defaultResync)
@@ -172,6 +182,7 @@ func NewSharedInformerFactoryWithOptions(client clientset.ClusterInterface, defa
172182
// Forward options to the factory
173183
factory.customResync = opts.customResync
174184
factory.tweakListOptions = opts.tweakListOptions
185+
factory.transform = opts.transform
175186
176187
return factory
177188
}
@@ -361,13 +372,15 @@ func WithNamespace(namespace string) SharedInformerOption {
361372
}
362373
}
363374
375+
364376
type sharedScopedInformerFactory struct {
365377
client scopedclientset.Interface
366378
namespace string
367379
tweakListOptions internalinterfaces.TweakListOptionsFunc
368380
lock sync.Mutex
369381
defaultResync time.Duration
370382
customResync map[reflect.Type]time.Duration
383+
transform cache.TransformFunc
371384
372385
informers map[reflect.Type]cache.SharedIndexInformer
373386
// startedInformers is used for tracking which informers have been started.
@@ -459,6 +472,7 @@ func (f *sharedScopedInformerFactory) InformerFor(obj runtime.Object, newFunc in
459472
}
460473
461474
informer = newFunc(f.client, resyncPeriod)
475+
informer.SetTransform(f.transform)
462476
f.informers[informerType] = informer
463477
464478
return informer

0 commit comments

Comments
 (0)