Refactor code around starting and stopping informers in agent
MR: Pending
Description
Agent cleanup(from secret-sync work Copy image pull secrets before generating works... (gitlab-org/cluster-integration/gitlab-agent!1811 - merged))
Handling image pull secrets led us to create another informer. We are blocking twice on the informer Start
code path waiting for a sync on the preexisting deployment informer and the new secret informer. We should refactor the code to allow concurrent sync of each informer as an optimization for startup.
Also on the informers, we are explicitly calling stop
to shut them down before creating a fresh new reconciler. It will be better to leverage stopping the informer by cancelling the context used to start them. This way we will not need to call stop explicitly and can have cancellation implicitly occur when context is cancelled.
Acceptance Criteria
-
sync informers on startup concurrently -
Explore and possibly use context to shutdown informers instead of calling stop