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{}) {
693
693
informer .NewResourceVersionInformer (synchro .cluster , config ).Run (stop )
694
694
}
695
695
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
+
696
704
func (synchro * eventSynchro ) OnAdd (obj interface {}, _ bool ) {
705
+ if synchro .isOrphanEvent (obj .(* corev1.Event )) {
706
+ // TODO(Iceber): cache orphan events
707
+ return
708
+ }
697
709
_ = synchro .queue .Add (obj , false )
698
710
}
699
711
700
712
func (synchro * eventSynchro ) OnUpdate (_ , obj interface {}, _ bool ) {
713
+ if synchro .isOrphanEvent (obj .(* corev1.Event )) {
714
+ // TODO(Iceber): cache orphan events
715
+ return
716
+ }
701
717
_ = synchro .queue .Update (obj , false )
702
718
}
703
719
You can’t perform that action at this time.
0 commit comments