Version protocol switch (#3833)

* Use version to determine plugin protocol to use

* Remove field from ServeOpts

* Fix missing assignment, handle errors

* contraint -> constraint

* Inject the version string from the vault side

* Fix the version check

* Add grpc support check to database plugins

* Default to use grpc unless missing env var or fail on contraint check

* Add GRPCSupport test

* Add greater than test case

* Add go-version dep
This commit is contained in:
Calvin Leung Huang
2018-01-23 17:29:26 -05:00
committed by GitHub
parent 4551b9250f
commit c3c63313f3
11 changed files with 1062 additions and 4 deletions

View File

@@ -47,8 +47,7 @@ func Serve(opts *ServeOpts) error {
return err
}
// If FetchMetadata is true, run without TLSProvider
plugin.Serve(&plugin.ServeConfig{
serveOpts := &plugin.ServeConfig{
HandshakeConfig: handshakeConfig,
Plugins: pluginMap,
TLSProvider: opts.TLSProviderFunc,
@@ -56,7 +55,14 @@ func Serve(opts *ServeOpts) error {
// A non-nil value here enables gRPC serving for this plugin...
GRPCServer: plugin.DefaultGRPCServer,
})
}
if !pluginutil.GRPCSupport() {
serveOpts.GRPCServer = nil
}
// If FetchMetadata is true, run without TLSProvider
plugin.Serve(serveOpts)
return nil
}