Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Add Additional gRPC service handler hook #620

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/common/service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package common

import (
"context"

"google.golang.org/grpc"
)

// RegisterAdditionalGRPCService is the interface for the plugin hook for additional GRPC service handlers which
// should be also served on the flyteadmin gRPC server.
type RegisterAdditionalGRPCService = func(ctx context.Context, grpcServer *grpc.Server) error
7 changes: 7 additions & 0 deletions pkg/server/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ func newGRPCServer(ctx context.Context, pluginRegistry *plugins.Registry, cfg *c
pluginRegistry.RegisterDefault(plugins.PluginIDDataProxy, dataProxySvc)
service.RegisterDataProxyServiceServer(grpcServer, plugins.Get[service.DataProxyServiceServer](pluginRegistry, plugins.PluginIDDataProxy))

additionalService := plugins.Get[common.RegisterAdditionalGRPCService](pluginRegistry, plugins.PluginIDAdditionalGRPCService)
if additionalService != nil {
if err := additionalService(ctx, grpcServer); err != nil {
return nil, err
}
}

service.RegisterSignalServiceServer(grpcServer, rpc.NewSignalServer(ctx, configuration, scope.NewSubScope("signal")))

healthServer := health.NewServer()
Expand Down
1 change: 1 addition & 0 deletions plugins/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
PluginIDUnaryServiceMiddleware PluginID = "UnaryServiceMiddleware"
PluginIDPreRedirectHook PluginID = "PreRedirectHook"
PluginIDLogoutHook PluginID = "LogoutHook"
PluginIDAdditionalGRPCService PluginID = "AdditionalGRPCService"
)

type AtomicRegistry struct {
Expand Down
Loading