Get connected agents by agent ids to optimize number of RPC calls
What does this MR do and why?
- Leverage
GetConnectedAgentsByAgentIds
gRPC method from KAS to potentially improve the number of gRPC calls. This gRPC method was introduced by Get connected agents by a list of agent or project (gitlab-org/cluster-integration/gitlab-agent!1162 - merged). - Current implementation could invoke multiple gRPC calls because it gets connected agents per project per call. Especially, in case the agent belongs to multiple projects, then it'll require multiple gRPC calls to get connected agents. With this MR, it will guarantee to invoke only single gRPC call of
GetConnectedAgentsByAgentIds
.
Screenshots or screen recordings
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
GraphQL Request
{
project(fullPath: "path/to/project") {
clusterAgents {
edges {
node {
name
connections {
edges {
node {
connectedAt
connectionId
metadata {
commit
podName
podNamespace
version
}
}
}
}
}
}
}
}
}
Response
{
"data": {
"project": {
"clusterAgents": {
"edges": [
{
"node": {
"name": "local-cluster-2",
"connections": {
"edges": [
{
"node": {
"connectedAt": "2023-11-06T17:34:30+09:00",
"connectionId": "1746283656355636121",
"metadata": {
"commit": "00000000",
"podName": "agentk",
"podNamespace": "default",
"version": "v0.0.0"
}
}
}
]
}
}
}
]
}
}
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Closes #430046 (closed)
Edited by Taka Nishida