Skip to content

endpoint: Discover statefulset hostnames

Administrator requested to merge core/statefulset-endpoints into master

Created by: keegancsmith

Pods in a stateful set have DNS addresses of the form podname.servicename. We can discover this by inspecting the endpoints from the headless service. They will have the Hostname field set on the endpoint address object. Note: only if podname.servicename is a valid address will hostname be set.

Additionally we support rpc:// scheme. When using the rpc scheme, we return address strings instead (ie hostname:port). This is what our rpc package expects.

This allows us to dynamically discover the pods in the indexed-search statefulset. This will allow kubernetes administrators to scale the indexed-search statefulset without needing to update the INDEXED_SEARCH_SERVERS configuration. Note: This commit does not update the default for that yet.

In future we could use this for gitservers as well (more testing required though, for example we don't want to use this if a gitserver has to be marked as ready).

Part of https://github.com/sourcegraph/sourcegraph/issues/5725

Merge request reports

Loading