Extract load balancing to a gem
What does this MR do and why?
Extracts gitlab's load balancer code to an internal gem as a first step towards testing the load balancer more thoroughly.
By extracting the code to a gem, it will become easier to boot it in isolation in CI, letting us perform complex end-to-end functional testing against a real patroni cluster with injected errors.
Does not attempt to extract sidekiq-related code, that will come later but was more tangled with the rest of the app than other load balancer code.
This work builds upon the load balancer extraction draft by @ayufan in Draft: Add `gitlab-database-load_balancing` gem (!136237 - closed), and includes those commits.
References
How to set up and validate locally
Run locally with load balancing (https://gitlab-org.gitlab.io/gitlab-development-kit/howto/database_load_balancing_with_service_discovery/), nothing should change after this MR, as it just moves the code around without changing it.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.