Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Register grpc reflection service in Init #1519

Merged
merged 3 commits into from
Oct 15, 2019
Merged
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
13 changes: 10 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions plugins/orchestrator/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func NewPlugin(opts ...Option) *Plugin {
p.GRPC = &grpc.DefaultPlugin
p.KVScheduler = &kvscheduler.DefaultPlugin
p.Watcher = local.DefaultRegistry
p.reflection = true

for _, o := range opts {
o(p)
Expand All @@ -42,3 +43,9 @@ func NewPlugin(opts ...Option) *Plugin {

// Option is a function that acts on a Plugin to inject Dependencies or configuration
type Option func(*Plugin)

func WithReflection(enabled bool) Option {
return func(p *Plugin) {
p.reflection = enabled
}
}
10 changes: 7 additions & 3 deletions plugins/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type Plugin struct {
resyncChan chan datasync.ResyncEvent
watchDataReg datasync.WatchRegistration

reflection bool

*dispatcher
}

Expand Down Expand Up @@ -79,6 +81,11 @@ func (p *Plugin) Init() (err error) {
if grpcServer := p.GRPC.GetServer(); grpcServer != nil {
generic.RegisterManagerServer(grpcServer, p.manager)
generic.RegisterMetaServiceServer(grpcServer, p.manager)
// register grpc services for reflection
if p.reflection {
p.Log.Infof("registering grpc reflection service")
reflection.Register(grpcServer)
}
} else {
p.log.Infof("grpc server not available")
}
Expand Down Expand Up @@ -117,9 +124,6 @@ func (p *Plugin) AfterInit() (err error) {
p.kvs.WatchValueStatus(statusChan, nil)
go p.watchStatus(statusChan)

// register grpc services for reflection
reflection.Register(p.GRPC.GetServer())

return nil
}

Expand Down
17 changes: 9 additions & 8 deletions vendor/google.golang.org/grpc/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/google.golang.org/grpc/CODE-OF-CONDUCT.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 44 additions & 18 deletions vendor/google.golang.org/grpc/CONTRIBUTING.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/google.golang.org/grpc/GOVERNANCE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions vendor/google.golang.org/grpc/MAINTAINERS.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/google.golang.org/grpc/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading