Skip to content

frontend: add service registry

Warren Gifford requested to merge sh/service-registry into main

Created by: stefanhengl

Why?

  • Frontend doesn't know the addresses of all services in the landscape
  • There are at least 2 ongoing projects (1-click export, health-check-tool) which require frontend to know about all services.

Goals

  • Create a simple but resilliant service registry
  • Support all environments Sourcegraph can run on (server, docker-compose, K8S, other containerized environments)
  • Don't require open ports other than those which are already open
  • Don't add another service
  • Don't create too much load on frontend

Non-goals

  • Make this a general purose service registry that is useful beyond Sourcegraph

Not part of this PR

  • a client for the service registry. Once/if this is merged, we can create a separate repo (sourcegraph/registry-client) that both Sourcegraph and Zoekt can import.

Design

image

Test plan

  • local testing
# create record
 curl -v -X POST http://localhost:3090/.internal/services/foobar -d '{"port": 8119, "health_check_path": "/healthz", "hostname": "host1"}'

# renew
curl -v -X PUT http://localhost:3090/.internal/services/foobar/127.0.0.1:8119

# delete
curl -v -X DELETE http://localhost:3090/.internal/services/foobar/127.0.0.1:8119
  • Checked that manually created entries expire if they are not renewed
  • Wrote a basic client for Zoekt (not part of this PR) and verified that db records show up as expected.

Merge request reports

Loading