File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -206,9 +206,12 @@ func (s *informerManagerImpl) Stop() {
206206}
207207
208208func (s * informerManagerImpl ) AddEventHandlerToInformer (resource schema.GroupVersionResource , handler cache.ResourceEventHandler ) {
209+ s .resourcesLock .Lock ()
210+ defer s .resourcesLock .Unlock ()
211+
209212 // Get or create the informer (this is idempotent - if it exists, we get the same instance)
210- // The idempotent behavior is important because it is called by both the change detector and informer populator ,
211- // which run concurrently on the leader hub agent .
213+ // The idempotent behavior is important because this method may be called multiple times ,
214+ // potentially concurrently, and relies on the shared informer instance from the factory .
212215 informer := s .informerFactory .ForResource (resource ).Informer ()
213216
214217 // Add the event handler to the informer
@@ -225,6 +228,7 @@ func (s *informerManagerImpl) CreateInformerForResource(resource APIResourceMeta
225228 if ! exist {
226229 // Register this resource in our tracking map
227230 resource .isPresent = true
231+ resource .isStaticResource = false
228232 s .apiResources [resource .GroupVersionKind ] = & resource
229233
230234 // Create the informer without adding any event handler
You can’t perform that action at this time.
0 commit comments