Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Implement graceful shutdown for client-go informers and add structured shutdown logs across shell-operator components.
What this PR does / why we need it
donechannel toFactoryand startsinformer.Run(...)exactly once per factory; closesdonewhen the goroutine exits.FactoryStore.Stop(...)now, upon removing the last handler, cancels the shared context and waits for<-donebefore deleting the factory entry.FactoryStore.WaitStopped(index)to block until a factory for a givenFactoryIndexfully stops.resourceInformer.wait()waits for shared informer termination viaFactoryStore.WaitStopped.namespaceInformerwrapsRun()with adonechannel and exposeswait().Monitornow hasWait()to wait for all resource/namespace informers to stop.KubeEventsManagernow hasWait()to aggregateMonitor.Wait()calls without holding locks while blocking.Shutdown()now logs each stage, cancelsKubeEventsManager, then waits for completion (Wait()), then stops and waits for queues.Special notes for your reviewer
KubeEventsManager.Wait()snapshots monitors underRLockand releases the lock before waiting, avoiding deadlocks and map iteration races.FactoryStore.Stop(...)waits outside the lock for thedonechannel, then reacquires the lock to delete the factory and broadcast to waiters.operator.Shutdown(); feel free to request additional log details or levels.cancel(), waits will block. Current behavior intentionally favors correctness. If desired, we can add timeouts toWait()paths in a follow-up.