Skip to content

Commit c66a4d0

Browse files
ecordellankitathomas
authored andcommitted
feat(grpc): enable reflection on grpc endpoints
(upstream operator-registry commit: ff43ba8941e6fa5fe5112f16dbc696a229344dde)
1 parent 02055cf commit c66a4d0

File tree

7 files changed

+4220
-9
lines changed

7 files changed

+4220
-9
lines changed

staging/operator-registry/Gopkg.lock

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/operator-registry/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ docker run -p 50051:50051 example-registry:latest
9090
[grpcurl](https://github.com/fullstorydev/grpcurl) is a useful for interacting with the example server.
9191

9292
```sh
93-
$ grpcurl -plaintext -proto ./pkg/api/registry.proto localhost:50051 list api.Registry
93+
$ grpcurl -plaintext localhost:50051 list api.Registry
9494
GetBundle
9595
GetBundleForChannel
9696
GetBundleThatReplaces
@@ -103,7 +103,7 @@ ListPackages
103103
```
104104

105105
```sh
106-
$ grpcurl -plaintext -proto ./pkg/api/registry.proto localhost:50051 api.Registry/ListPackages
106+
$ grpcurl -plaintext localhost:50051 api.Registry/ListPackages
107107
```
108108
```json
109109
{
@@ -115,7 +115,7 @@ $ grpcurl -plaintext -proto ./pkg/api/registry.proto localhost:50051 api.Regist
115115
```
116116

117117
```sh
118-
$ grpcurl -plaintext -proto ./pkg/api/registry.proto -d '{"name":"etcd"}' localhost:50051 api.Registry/GetPackage
118+
$ grpcurl -plaintext -d '{"name":"etcd"}' localhost:50051 api.Registry/GetPackage
119119
```
120120
```json
121121
{
@@ -131,7 +131,7 @@ $ grpcurl -plaintext -proto ./pkg/api/registry.proto -d '{"name":"etcd"}' localh
131131
```
132132

133133
```sh
134-
$ grpcurl -proto ./pkg/api/registry.proto localhost:50051 describe api.Registry.GetBundleForChannel
134+
$ grpcurl localhost:50051 describe api.Registry.GetBundleForChannel
135135
api.Registry.GetBundleForChannel is a method:
136136
```
137137
```json
@@ -145,7 +145,7 @@ api.Registry.GetBundleForChannel is a method:
145145
```
146146

147147
```sh
148-
$ grpcurl -proto ./pkg/api/registry.proto localhost:50051 describe api.GetBundleInChannelRequest
148+
$ grpcurl localhost:50051 describe api.GetBundleInChannelRequest
149149
api.GetBundleInChannelRequest is a message:
150150
```
151151
```json
@@ -180,7 +180,7 @@ api.GetBundleInChannelRequest is a message:
180180
```
181181

182182
```sh
183-
$ grpcurl -plaintext -proto ./pkg/api/registry.proto -d '{"pkgName":"etcd","channelName":"alpha"}' localhost:50051 api.Registry/GetBundleForChannel
183+
$ grpcurl -plaintext -d '{"pkgName":"etcd","channelName":"alpha"}' localhost:50051 api.Registry/GetBundleForChannel
184184
```
185185
```json
186186
{

staging/operator-registry/cmd/configmap-server/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/sirupsen/logrus"
88
"github.com/spf13/cobra"
99
"google.golang.org/grpc"
10+
"google.golang.org/grpc/reflection"
1011
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1112
"k8s.io/client-go/kubernetes"
1213
"k8s.io/client-go/rest"
@@ -107,6 +108,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
107108
s := grpc.NewServer()
108109

109110
api.RegisterRegistryServer(s, server.NewRegistryServer(store))
111+
reflection.Register(s)
110112

111113
log.Info("serving registry")
112114
if err := s.Serve(lis); err != nil {

staging/operator-registry/cmd/registry-server/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/sirupsen/logrus"
88
"github.com/spf13/cobra"
99
"google.golang.org/grpc"
10+
"google.golang.org/grpc/reflection"
1011

1112
"github.com/operator-framework/operator-registry/pkg/api"
1213
"github.com/operator-framework/operator-registry/pkg/server"
@@ -74,7 +75,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
7475
s := grpc.NewServer()
7576

7677
api.RegisterRegistryServer(s, server.NewRegistryServer(store))
77-
78+
reflection.Register(s)
7879
log.Info("serving registry")
7980
if err := s.Serve(lis); err != nil {
8081
log.Fatalf("failed to serve: %v", err)

0 commit comments

Comments
 (0)