endpoint: Discover statefulset hostnames
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
Activity
Created by: codecov[bot]
Codecov Report
Merging #6295 into master will increase coverage by
0.03%
. The diff coverage is42.85%
.@@ Coverage Diff @@ ## master #6295 +/- ## ========================================== + Coverage 39.04% 39.08% +0.03% ========================================== Files 1187 1187 Lines 60692 60696 +4 Branches 5807 5807 ========================================== + Hits 23700 23723 +23 + Misses 34815 34796 -19 Partials 2177 2177
Impacted Files Coverage Δ internal/endpoint/endpoint.go 43.8% <42.85%> (+18.16%)
cmd/frontend/graphqlbackend/repository.go 21.84% <0%> (-0.98%)
internal/search/backend/horizontal.go 90.32% <0%> (+1.61%)