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

Commit

Permalink
Add Additional gRPC service handler hook
Browse files Browse the repository at this point in the history
Signed-off-by: Katrina Rogan <[email protected]>
  • Loading branch information
katrogan committed Oct 3, 2023
1 parent fbdb162 commit e9aa342
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
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

0 comments on commit e9aa342

Please sign in to comment.