etcd,cp: Add support for fetching realservers from a JSON file

In some scenarios and testing environments it's useful to be able to set a list of realservers in a JSON file instead of fetching them from an etcd server. If the config key etcd.client is set to "file", liberica control plane will attempt to fetch a list of realservers from /etc/liberica/dc/service.json with the following structure:

{
  "nodes": [
    {
      "hostname": "foo1001.eqiad.wmnet",
      "pooled": "yes",
      "weight": 100
    },
    {
      "hostname": "foo1002.eqiad.wmnet",
      "pooled": "yes",
      "weight": 100
    }
  ]
}

Only Get() has been implemented at this point, a restart of the control plane is required to refresh it after updating the JSON file.

The etcdv2client will be used as the default client. This commit also sets the foundations to be able to pick between etcd clients, something that will be useful to perform the eventual migration to etcd v3.

Bug: T399502

Merge request reports

Loading