File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
pkg/synchromanager/clustersynchro Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -693,11 +693,27 @@ func (synchro *eventSynchro) Start(stop <-chan struct{}) {
693693 informer .NewResourceVersionInformer (synchro .cluster , config ).Run (stop )
694694}
695695
696+ func (synchro * eventSynchro ) isOrphanEvent (event * corev1.Event ) bool {
697+ key := cache .NewObjectName (event .InvolvedObject .Namespace , event .InvolvedObject .Name ).String ()
698+ synchro .synchro .rvsLock .Lock ()
699+ _ , ok := synchro .synchro .rvs [key ]
700+ synchro .synchro .rvsLock .Unlock ()
701+ return ! ok
702+ }
703+
696704func (synchro * eventSynchro ) OnAdd (obj interface {}, _ bool ) {
705+ if synchro .isOrphanEvent (obj .(* corev1.Event )) {
706+ // TODO(Iceber): cache orphan events
707+ return
708+ }
697709 _ = synchro .queue .Add (obj , false )
698710}
699711
700712func (synchro * eventSynchro ) OnUpdate (_ , obj interface {}, _ bool ) {
713+ if synchro .isOrphanEvent (obj .(* corev1.Event )) {
714+ // TODO(Iceber): cache orphan events
715+ return
716+ }
701717 _ = synchro .queue .Update (obj , false )
702718}
703719
You can’t perform that action at this time.
0 commit comments