Skip to content

Commit

Permalink
feat(kuma-cp): add unary interceptors to KDS server (kumahq#8060)
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Beaumont <[email protected]>
  • Loading branch information
michaelbeaumont authored Oct 17, 2023
1 parent cd8db53 commit 5ab6b44
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/kds/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Context struct {

EnvoyAdminRPCs service.EnvoyAdminRPCs
ServerStreamInterceptors []grpc.StreamServerInterceptor
ServerUnaryInterceptor []grpc.UnaryServerInterceptor
}

func DefaultContext(
Expand Down
1 change: 1 addition & 0 deletions pkg/kds/global/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func Setup(rt runtime.Runtime) error {
onSessionStarted,
rt.KDSContext().GlobalServerFilters,
rt.KDSContext().ServerStreamInterceptors,
rt.KDSContext().ServerUnaryInterceptor,
*rt.Config().Multizone.Global.KDS,
rt.Metrics(),
service.NewGlobalKDSServiceServer(
Expand Down
4 changes: 4 additions & 0 deletions pkg/kds/mux/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type server struct {
serviceServer *service.GlobalKDSServiceServer
kdsSyncServiceServer *KDSSyncServiceServer
streamInterceptors []grpc.StreamServerInterceptor
unaryInterceptors []grpc.UnaryServerInterceptor
mesh_proto.UnimplementedMultiplexServiceServer
}

Expand All @@ -74,6 +75,7 @@ func NewServer(
callbacks Callbacks,
filters []Filter,
streamInterceptors []grpc.StreamServerInterceptor,
unaryInterceptors []grpc.UnaryServerInterceptor,
config multizone.KdsServerConfig,
metrics core_metrics.Metrics,
serviceServer *service.GlobalKDSServiceServer,
Expand All @@ -87,6 +89,7 @@ func NewServer(
serviceServer: serviceServer,
kdsSyncServiceServer: kdsSyncServiceServer,
streamInterceptors: streamInterceptors,
unaryInterceptors: unaryInterceptors,
}
}

Expand Down Expand Up @@ -127,6 +130,7 @@ func (s *server) Start(stop <-chan struct{}) error {
}
grpcOptions = append(
grpcOptions,
grpc.ChainUnaryInterceptor(s.unaryInterceptors...),
grpc.ChainUnaryInterceptor(otelgrpc.UnaryServerInterceptor()),
)
grpcServer := grpc.NewServer(grpcOptions...)
Expand Down

0 comments on commit 5ab6b44

Please sign in to comment.