gRPC name resolver by using kubernetes API that watches namespace and label to resolve new connection in realtime.
import _ "github.com/ldmtam/tam-grpc-resolver" // don't forget to import the resolver
conn, err := grpc.DialContext(
context.TODO(),
"tam:https:///calculator-server.default:8080",
grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
log.Fatalf("dial to calculator server failed: %v", err)
}
defer conn.Close()
An URL should have the following format
tam:https:///{app_name}.{namespace}
tam:https:///{app_name}.{namespace}:{port}
Example Project
https://github.com/ldmtam/calculator-service