mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-16 23:28:25 +00:00
Reflector: support logging Unstructured type
Add an annotation that can be added to the exampleType passed to NewReflector to indicate the expected type for the Reflector. This is useful for types such as unstuctured.Unstructured, which, when used with a dynamic informer, do not have their TypeMeta filled in. Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com> Kubernetes-commit: 474fc8c5234000bce666a6b02f7ffbb295ef135f
This commit is contained in:
committed by
Kubernetes Publisher
parent
d21defd4b1
commit
37897aff8d
@@ -120,7 +120,7 @@ func (f *dynamicSharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{})
|
||||
func NewFilteredDynamicInformer(client dynamic.Interface, gvr schema.GroupVersionResource, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions TweakListOptionsFunc) informers.GenericInformer {
|
||||
return &dynamicInformer{
|
||||
gvr: gvr,
|
||||
informer: cache.NewSharedIndexInformer(
|
||||
informer: cache.NewSharedIndexInformerWithOptions(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
@@ -136,8 +136,11 @@ func NewFilteredDynamicInformer(client dynamic.Interface, gvr schema.GroupVersio
|
||||
},
|
||||
},
|
||||
&unstructured.Unstructured{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
cache.SharedIndexInformerOptions{
|
||||
ResyncPeriod: resyncPeriod,
|
||||
Indexers: indexers,
|
||||
ObjectDescription: gvr.String(),
|
||||
},
|
||||
),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user