Modify Praefect's server info implementation
Change praefect's server info implementation to only get the server status of the primary node. If there are multiple entries in the internal gitaly config, only return the one that matches the internal node's name.
This is because a common configuration pattern (in fact the one in the prafect docs ) is that if there are 3 internal gitaly nodes all 3 gitaly nodes use the same config:
[[storage]]
name = 'gitaly-1'
path = '/var/opt/gitlab/git-data/repositories'
[[storage]]
name = 'gitaly-2'
path = '/var/opt/gitlab/git-data/repositories'
[[storage]]
name = 'gitaly-3'
path = '/var/opt/gitlab/git-data/repositories'
Also, when making this change it became impossible to test with our global gitaly config struct. For this modification to work, we have to somehow inject the storages into the ServerService
struct. Because of that, I added some code to dependency inject the config struct from the gitaly server constructor.
My suggestion is to move in this direction anyways given all of the issues we have with testing using a global config variable, so this is a good opportunity for that first step.
fixes: #2596 (closed)