From 302b0e4bd27251bb8a1f21192e71114e71581afe Mon Sep 17 00:00:00 2001 From: Hongxin Liang Date: Fri, 28 Aug 2020 09:47:39 +0200 Subject: [PATCH] Support gRPC health checking This addresses https://github.com/lyft/flyte/issues/489. For now only server level health checking is supported but we could extend to service level when needed later. --- cmd/entrypoints/serve.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/entrypoints/serve.go b/cmd/entrypoints/serve.go index 6322b1935..6b0327460 100644 --- a/cmd/entrypoints/serve.go +++ b/cmd/entrypoints/serve.go @@ -20,6 +20,8 @@ import ( "github.com/lyft/flyteadmin/pkg/server" "github.com/pkg/errors" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/health" + "google.golang.org/grpc/health/grpc_health_v1" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/lyft/flyteadmin/pkg/common" @@ -90,6 +92,11 @@ func newGRPCServer(ctx context.Context, cfg *config.ServerConfig, authContext in grpcServer := grpc.NewServer(serverOpts...) grpc_prometheus.Register(grpcServer) flyteService.RegisterAdminServiceServer(grpcServer, adminservice.NewAdminServer(cfg.KubeConfig, cfg.Master)) + + healthServer := health.NewServer() + healthServer.SetServingStatus("", grpc_health_v1.HealthCheckResponse_SERVING) + grpc_health_v1.RegisterHealthServer(grpcServer, healthServer) + if cfg.GrpcServerReflection { reflection.Register(grpcServer) }