Agent: Call Rails API to fetch prerequisite information before starting reconciliation
MR: Shared namespace support (gitlab-org/cluster-integration/gitlab-agent!2351 - merged)
Description
Before the agent can start up, it needs to know about the namespaces on which it will start an informer. We do not want to read the value from the agent configuration because we have made this decision explicitly as it helps us to move away from a file based configuration in the future.
In Rails: Add API that agent will call to fetch in... (#519261 - closed) , the API will be introduced in Rails. This issue is about calling that API before starting the informers in the agent.
Acceptance criteria
-
The /internal/kubernetes/modules/remote_development/prerequisitesAPI is called to determine the mode in which the agent is running -unique/shared. -
If the agent is running in unique mode, the informers will watch in all namespaces. (existing behaviour) -
If the agent is running in shared mode, the informers will watch in only the shared_namespaceas passed from the API.
Implementation plan
- Update
internal/module/remote_development/agent/factory.goto call the/internal/kubernetes/modules/remote_development/prerequisitesAPI. - Extract the two fields from it -
workspace_namespace_modeandshared_namespace. - If
workspace_namespace_modeisunique, existing behaviour of informers watching in all namespaces continue. - If
workspace_namespace_modeisshared, the informers will be watching in theshared_namespacenamespace only.
Reference implementation can be found in Draft: Spike: Workspaces in a single namespace (gitlab-org/cluster-integration/gitlab-agent!2239 - closed) .
Edited by Vishal Tak