@@ -14,11 +14,13 @@ import (
1414 "github.com/letsencrypt/boulder/cmd"
1515 bcreds "github.com/letsencrypt/boulder/grpc/creds"
1616
17- // 'grpc/health' is imported for its init function, which causes clients to
18- // rely on the Health Service for load-balancing.
1917 // 'grpc/internal/resolver/dns' is imported for its init function, which
2018 // registers the SRV resolver.
2119 "google.golang.org/grpc/balancer/roundrobin"
20+
21+ // 'grpc/health' is imported for its init function, which causes clients to
22+ // rely on the Health Service for load-balancing as long as a
23+ // "healthCheckConfig" is specified in the gRPC service config.
2224 _ "google.golang.org/grpc/health"
2325
2426 _ "github.com/letsencrypt/boulder/grpc/internal/resolver/dns"
@@ -61,7 +63,21 @@ func ClientSetup(c *cmd.GRPCClientConfig, tlsConfig *tls.Config, statsRegistry p
6163 creds := bcreds .NewClientCredentials (tlsConfig .RootCAs , tlsConfig .Certificates , hostOverride )
6264 return grpc .NewClient (
6365 target ,
64- grpc .WithDefaultServiceConfig (fmt .Sprintf (`{"loadBalancingConfig": [{"%s":{}}]}` , roundrobin .Name )),
66+ grpc .WithDefaultServiceConfig (
67+ fmt .Sprintf (
68+ // By setting the service name to an empty string in
69+ // healthCheckConfig, we're instructing the gRPC client to query
70+ // the overall health status of each server. The grpc-go health
71+ // server, as constructed by health.NewServer(), unconditionally
72+ // sets the overall service (e.g. "") status to SERVING. If a
73+ // specific service name were set, the server would need to
74+ // explicitly transition that service to SERVING; otherwise,
75+ // clients would receive a NOT_FOUND status and the connection
76+ // would be marked as unhealthy (TRANSIENT_FAILURE).
77+ `{"healthCheckConfig": {"serviceName": ""},"loadBalancingConfig": [{"%s":{}}]}` ,
78+ roundrobin .Name ,
79+ ),
80+ ),
6581 grpc .WithTransportCredentials (creds ),
6682 grpc .WithChainUnaryInterceptor (unaryInterceptors ... ),
6783 grpc .WithChainStreamInterceptor (streamInterceptors ... ),
0 commit comments