Refactor plugin catalog set functions (#22666)

Use a struct arg instead of a long list of args. Plugins running in containers
will require even more args and it's getting difficult to maintain.
This commit is contained in:
Tom Proctor
2023-08-31 10:32:24 +01:00
committed by GitHub
parent 1acd0c6d24
commit 3e55447036
6 changed files with 155 additions and 62 deletions

View File

@@ -61,6 +61,20 @@ type PluginRunner struct {
BuiltinFactory func() (interface{}, error) `json:"-" structs:"-"`
}
// SetPluginInput is only used as input for the plugin catalog's set methods.
// We don't use the very similar PluginRunner struct to avoid confusion about
// what's settable, which does not include the builtin fields.
type SetPluginInput struct {
Name string
Type consts.PluginType
Version string
Command string
OCIImage string
Args []string
Env []string
Sha256 []byte
}
// Run takes a wrapper RunnerUtil instance along with the go-plugin parameters and
// returns a configured plugin.Client with TLS Configured and a wrapping token set
// on PluginUnwrapTokenEnv for plugin process consumption.