@@ -46,6 +46,7 @@ import (
46
46
47
47
"github.com/openyurtio/openyurt/cmd/yurthub/app/options"
48
48
"github.com/openyurtio/openyurt/pkg/projectinfo"
49
+ pkgutil "github.com/openyurtio/openyurt/pkg/util"
49
50
"github.com/openyurtio/openyurt/pkg/yurthub/cachemanager"
50
51
"github.com/openyurtio/openyurt/pkg/yurthub/certificate"
51
52
certificatemgr "github.com/openyurtio/openyurt/pkg/yurthub/certificate/manager"
@@ -277,19 +278,24 @@ func registerInformers(options *options.YurtHubOptions,
277
278
informerFactory informers.SharedInformerFactory ,
278
279
workingMode util.WorkingMode ,
279
280
tenantNs string ) {
281
+
280
282
// configmap informer is used by Yurthub filter approver
281
283
newConfigmapInformer := func (client kubernetes.Interface , resyncPeriod time.Duration ) cache.SharedIndexInformer {
282
284
tweakListOptions := func (options * metav1.ListOptions ) {
283
285
options .FieldSelector = fields.Set {"metadata.name" : util .YurthubConfigMapName }.String ()
284
286
}
285
- return coreinformers .NewFilteredConfigMapInformer (client , options .YurtHubNamespace , resyncPeriod , nil , tweakListOptions )
287
+ informer := coreinformers .NewFilteredConfigMapInformer (client , options .YurtHubNamespace , resyncPeriod , nil , tweakListOptions )
288
+ informer .SetTransform (pkgutil .TransformStripManagedFields ())
289
+ return informer
286
290
}
287
291
informerFactory .InformerFor (& corev1.ConfigMap {}, newConfigmapInformer )
288
292
289
293
// secret informer is used by Tenant manager, this feature is not enabled in general.
290
294
if tenantNs != "" {
291
295
newSecretInformer := func (client kubernetes.Interface , resyncPeriod time.Duration ) cache.SharedIndexInformer {
292
- return coreinformers .NewFilteredSecretInformer (client , tenantNs , resyncPeriod , nil , nil )
296
+ informer := coreinformers .NewFilteredSecretInformer (client , tenantNs , resyncPeriod , nil , nil )
297
+ informer .SetTransform (pkgutil .TransformStripManagedFields ())
298
+ return informer
293
299
}
294
300
informerFactory .InformerFor (& corev1.Secret {}, newSecretInformer )
295
301
}
@@ -300,10 +306,20 @@ func registerInformers(options *options.YurtHubOptions,
300
306
listOptions := func (ops * metav1.ListOptions ) {
301
307
ops .FieldSelector = fields.Set {"spec.nodeName" : options .NodeName }.String ()
302
308
}
303
- return coreinformers .NewFilteredPodInformer (client , "" , resyncPeriod , nil , listOptions )
309
+ informer := coreinformers .NewFilteredPodInformer (client , "" , resyncPeriod , nil , listOptions )
310
+ informer .SetTransform (pkgutil .TransformStripManagedFields ())
311
+ return informer
304
312
}
305
313
informerFactory .InformerFor (& corev1.Pod {}, newPodInformer )
306
314
}
315
+
316
+ // service informer is used by serviceTopologyFilter
317
+ newServiceInformer := func (client kubernetes.Interface , resyncPeriod time.Duration ) cache.SharedIndexInformer {
318
+ informer := coreinformers .NewFilteredServiceInformer (client , "" , resyncPeriod , nil , nil )
319
+ informer .SetTransform (pkgutil .TransformStripManagedFields ())
320
+ return informer
321
+ }
322
+ informerFactory .InformerFor (& corev1.Service {}, newServiceInformer )
307
323
}
308
324
309
325
func prepareServerServing (options * options.YurtHubOptions , certMgr certificate.YurtCertificateManager , cfg * YurtHubConfiguration ) error {
0 commit comments