Use ServerInfo gRPC endpoint to retrieve KAS version
KAS %17.0 will support a ServerInfo::GetServerInfo()
gRPC endpoint to retrieve the version of KAS.
Context:
- (first iteration) Implement gRPC endpoint to get the KAS version (gitlab-org/cluster-integration/gitlab-agent#549 - closed)
- (later iteration) Enrich Server Info endpoint with information fr... (gitlab-org/cluster-integration/gitlab-agent#565)
The first issue is already implemented and good enough for a first iteration.
Proposal
Instead of the current logic to get the version from the version file (and sometimes falling back to the GitLab version itself), we can actually use the new endpoint to retrieve that information.
The following method in the lib/gitlab/kas/client.rb
can be implemented:
def get_server_info
request = Gitlab::Agent::ServerInfo::Rpc::GetServerInfoRequest.new()
stub_for(:server_info)
.get_server_info(request, metadata: metadata)
end
after the kas-grpc
gem has been upgraded to at least 0.6.0
(which is not released at the time of writing this).
Here is an example output of the gdk rails console
from that method call:
[1] pry(main)> client = Gitlab::Kas::Client.new()
=> #<Gitlab::Kas::Client:0x0000000173235068>
[2] pry(main)> client.get_server_info()
=> <Gitlab::Agent::ServerInfo::Rpc::GetServerInfoResponse: current_server_info: <Gitlab::Agent::ServerInfo::ServerInfo: version: "v17.0.0-rc1-24-g06dbc13d", build_ref: "06dbc13d", build_time: <Google::Protobuf::Timestamp: seconds: 1714380975, nanos: 0>>>
[3] pry(main)>
Edited by Timo Furrer