Skip to content

gitserver: Infer hostname from frontend requests

Administrator requested to merge rs/gitserver-shard-header into main

Created by: ryanslade

In order to shard repos across gitserver instance we need a consistent view of our list of gitserver instances and the hostnames of each gitserver instance across all frontend and gitserver instances.

Instead of doing this by sharing environment variables we'll keep frontend as the single source of truth and requests made from it to gitserver will be used to determine the hostname of each gitserver instance.

This means that when gitservers first start up they will not know their own address until they receive their first request from frontend.

The "wrong shard cleanup" was removed since during a gitserver rebalance we don't want existing gitserver instances to remove repos that have been newly allocated to them before they pick up the new configuration since it is only picked up on restart. The existing disk pressure cleanup will continue to ensure that unused repos will eventually be removed.

During a deployment the list of gitserver addresses could change we therefore only perform a sync of all repos state once the list has stabilised.

Closes: https://github.com/sourcegraph/sourcegraph/issues/19098

Merge request reports

Loading