Merge pull request #3744 from KnVerey/plugin-dir-error

Do no require exec/go plugin home to use fn plugins
This commit is contained in:
Jeff Regan
2021-03-26 11:26:48 -07:00
committed by GitHub
15 changed files with 169 additions and 116 deletions

View File

@@ -23,7 +23,7 @@ func (e *errUnableToFind) Error() string {
m = append(m, "('"+p.Value+"'; "+p.Key+")")
}
return fmt.Sprintf(
"unable to find plugin root - tried: %s", strings.Join(m, ", "))
"unable to find %s - tried: %s", e.what, strings.Join(m, ", "))
}
func NewErrUnableToFind(w string, a []Pair) *errUnableToFind {

View File

@@ -5,25 +5,6 @@ package types
// PluginConfig holds plugin configuration.
type PluginConfig struct {
// AbsPluginHome is the home of kustomize plugins.
// Kustomize plugin configuration files are k8s-style objects
// containing the fields 'apiVersion' and 'kind', e.g.
// apiVersion: apps/v1
// kind: Deployment
// kustomize reads plugin configuration data from a file path
// specified in the 'generators:' or 'transformers:' field of a
// kustomization file. kustomize must then use this data to both
// locate the plugin and configure it.
// Every kustomize plugin (its code, its tests, its supporting data
// files, etc.) must be housed in its own directory at
// ${AbsPluginHome}/${pluginApiVersion}/LOWERCASE(${pluginKind})
// where
// - ${AbsPluginHome} is an absolute path, defined below.
// - ${pluginApiVersion} is taken from the plugin config file.
// - ${pluginKind} is taken from the plugin config file.
// The value of AbsPluginHome can be any absolute path.
AbsPluginHome string
// PluginRestrictions distinguishes plugin restrictions.
PluginRestrictions PluginRestrictions
@@ -33,3 +14,21 @@ type PluginConfig struct {
// FnpLoadingOptions sets the way function-based plugin behaviors.
FnpLoadingOptions FnPluginLoadingOptions
}
func EnabledPluginConfig(b BuiltinPluginLoadingOptions) *PluginConfig {
return MakePluginConfig(PluginRestrictionsNone, b)
}
func DisabledPluginConfig() *PluginConfig {
return MakePluginConfig(
PluginRestrictionsBuiltinsOnly,
BploUseStaticallyLinked)
}
func MakePluginConfig(pr PluginRestrictions,
b BuiltinPluginLoadingOptions) *PluginConfig {
return &PluginConfig{
PluginRestrictions: pr,
BpLoadingOptions: b,
}
}