-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add remote gRPC option for storage plugin #3383
Conversation
Adds the option to host a gRPC storage API on a remote endpoint using regular gRPC. Previously the plugin system only supported local socket connections through the go-hashicorp plugin system. Signed-off-by: Matvey Arye <[email protected]>
292d7a4
to
c86a3de
Compare
I couldn't find how the existing plugin was tested end-to-end, so couldn't write better tests. If more tests are needed, please point me in the right direction. |
Also wasn't sure about the CLI option naming. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we adapt grpc-plugin storage integration test to test via remote grpc as well?
plugin/storage/grpc/options.go
Outdated
pluginServer = "grpc-storage-plugin.server" | ||
pluginTLS = "grpc-storage-plugin.tls" | ||
pluginCAFile = "grpc-storage-plugin.ca-file" | ||
pluginServerHostOverride = "grpc-storage-plugin.server-host-override" | ||
pluginConnectionTimeout = "grpc-storage-plugin.connection-timeout" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can just call it grpc-storage, not the plugin
plugin test is here Lines 105 to 107 in 745587a
|
@yurishkuro for the integration tests I will need to either:
Option 1 is less code changes but the examples become a bit more muddled. Do you have any preference if we want a separate example for this? |
I think option 1 is ok, but I was also thinking that the plugin / grpc server implemented in examples/memstore-plugin is actually pretty boiler plate and just invokes shared |
Hmm I like that idea. Let me try it out. |
Use the tlscfg package for the TLS configuration and change the cli option prefix from `grpc-storage-plugin` to `grpc-storage`. Signed-off-by: Matvey Arye <[email protected]>
We also created a RegisterServer method on StorageGRPCPlugin to register be able to easily create remote GRPC servers. Signed-off-by: Matvey Arye <[email protected]>
Also ran `make fmt` Signed-off-by: Matvey Arye <[email protected]>
564b78d
to
fb3e2bc
Compare
plugin/storage/grpc/options.go
Outdated
var tlsFlagsConfig = tlsFlagsConfig() | ||
tlsFlagsConfig.AddFlags(flagSet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var tlsFlagsConfig = tlsFlagsConfig() | |
tlsFlagsConfig.AddFlags(flagSet) | |
tlsFlagsConfig().AddFlags(flagSet) |
plugin/storage/grpc/shared/plugin.go
Outdated
// GRPCServer implements plugin.GRPCPlugin. It is used by go-plugin to create a grpc plugin server. | ||
func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { | ||
// RegisterServer registers the plugin with the server | ||
func (p *StorageGRPCPlugin) RegisterServer(s *grpc.Server) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (p *StorageGRPCPlugin) RegisterServer(s *grpc.Server) error { | |
func (p *StorageGRPCPlugin) RegisterHandlers(s *grpc.Server) error { |
err := queryPlugin.RegisterServer(s.server) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err := queryPlugin.RegisterServer(s.server) | |
if err != nil { | |
if err := queryPlugin.RegisterServer(s.server); err != nil { |
err = s.server.Serve(listener) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = s.server.Serve(listener) | |
if err != nil { | |
if err := s.server.Serve(listener); err != nil { |
"--grpc-storage-plugin.binary", binaryPath, | ||
"--grpc-storage-plugin.log-level", "debug", | ||
} | ||
if configPath != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check seems unnecessary, will it fail if we append --grpc-storage-plugin.configuration-file
with empty string value?
Codecov Report
@@ Coverage Diff @@
## main #3383 +/- ##
==========================================
+ Coverage 96.49% 96.51% +0.02%
==========================================
Files 261 262 +1
Lines 15277 15307 +30
==========================================
+ Hits 14741 14774 +33
+ Misses 453 452 -1
+ Partials 83 81 -2
Continue to review full report at Codecov.
|
Signed-off-by: Matvey Arye <[email protected]>
Signed-off-by: Matvey Arye <[email protected]>
Thanks for the detailed review @yurishkuro. I think I addressed all the issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some tests to plugin/storage/grpc/memory
I recommend running make test lint
locally before submitting
@@ -87,6 +140,31 @@ func (s *GRPCStorageIntegrationTestSuite) cleanUp() error { | |||
return s.initialize() | |||
} | |||
|
|||
type memoryStorePlugin struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need this type in the test, or can you use one from plugin/storage/grpc/memory/plugin.go ?
plugin/storage/grpc/config/config.go
Outdated
if c.PluginBinary == "" { | ||
return c.RemoteTLS.Close() | ||
} | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if c.PluginBinary == "" { | |
return c.RemoteTLS.Close() | |
} | |
return nil | |
return c.RemoteTLS.Close() |
the check is not necessary, TLSConfig.Close() is safe to call
Signed-off-by: Matvey Arye <[email protected]>
Signed-off-by: Matvey Arye <[email protected]>
476354f
to
c4a1b01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: Yuri Shkuro <[email protected]>
With upstream support for remote gPRC storage plugins [1], our query proxy is no longer required. Updated documentation to illustrate how to use jaeger standalone. [1]: jaegertracing/jaeger#3383
With upstream support for remote gPRC storage plugins [1], our query proxy is no longer required. Updated documentation to illustrate how to use jaeger standalone. [1]: jaegertracing/jaeger#3383
Which problem is this PR solving?
Resolves #3377
Resolves #1519
Short description of the changes
Adds the option to host a gRPC storage API on a remote endpoint
using regular gRPC. Previously the plugin system only supported
local socket connections through the go-hashicorp plugin system.