Gitaly clients should send express a desired server version preference

Gitaly clients (workhorse, rails, etc) should express a preference for a (range) of server versions.

Since the standard for declaring a version range is semver I recommend we stick with that.

How would this work

One each request (or on connection), the client sends a header semver expression for the expected server version.

For example:

:expected-server-version: ^0.59.0

The server is aware of the version of the software running and can validate the request. This could initially generate a warning (via a Prometheus counter), followed by rejection of the message.

Further down the road, after the (possible) adoption of Istio or Envoy in cloud-native GitLab, it might make sense to route requests to different versions of Gitaly running side-by-side on the same node.

Implementation

  1. Client adds a expected-server-version: '^' + GITALY_SERVER_VERSION header to requests.
  2. Server adds a grpc middleware to verify the header.