-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Right now config-server has hardcoded references to data-server and schema-server.
https://github.com/iptecharch/config-server/blob/5ec6a7bd4c7ab46cb9a69fc9e84fbec9289ee2f5/main.go#L63
https://github.com/iptecharch/config-server/blob/e74613e55333f0002eeb6d6622f5a30ac63089b9/pkg/sdc/ctx/schemaserver_context.go#L39
This is problematic in case we want to pull the services apart but not just then, but also if someone tries to run e.g. just config-server via telepresence in the local dev environment.
You then need to also run data-server straight away with it.
telepresence provides the means to resolving the services in the cluster and does route traffic back to it, such that running only config-server on den dev machine would be possible.
My suggestion is to then not rely on A/AAAA records but the SRV records that are populated for our named services with defined protocol and port number.
So we should use a resolver that resolves the srv record "_data-service._tcp.data-server.network-system.svc.cluster.local" (lets maybe even rename the port from data-service to grpc) takes the port and yielded dns name and build the grpc connection based on that.
service := "data-service"
protocol := "tcp"
name := "data-server.network-system.svc.cluster.local"
_, srvs, err := net.LookupSRV(service, protocol, name)
if err != nil {
panic(err)
}
for _, srv := range srvs {
fmt.Printf("Target: %s, Port: %d\n", srv.Target, srv.Port)
}Should we maybe also make the server read these SRV records and base its bringup on it, if the SRV record is available?
We would also need to introduce a seperate service for the schema-server.