Documentation ¶
Index ¶
- func ConfigurePlugin(ctx context.Context, coreConfig CoreConfig, configurer Configurer, ...) (string, error)
- func PluginNameFromHostServiceContext(ctx context.Context) (string, bool)
- func ReconfigureOnSignal(ctx context.Context, log logrus.FieldLogger, reconfigurer Reconfigurer) error
- func ReconfigureTask(log logrus.FieldLogger, reconfigurer Reconfigurer) func(context.Context) error
- func WithPluginName(ctx context.Context, name string) context.Context
- type BuiltIn
- type BuiltInConfig
- type Catalog
- type Config
- type Configurer
- type ConfigurerFunc
- type Constraints
- type CoreConfig
- type DataSource
- type Facade
- type FileData
- type FixedData
- type Plugin
- type PluginConfig
- type PluginConfigs
- type PluginInfo
- type PluginRepo
- type Reconfigurable
- type Reconfigurer
- type Reconfigurers
- type Repository
- type ServiceRepo
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigurePlugin ¶ added in v1.10.0
func ConfigurePlugin(ctx context.Context, coreConfig CoreConfig, configurer Configurer, dataSource DataSource, lastHash string) (string, error)
func ReconfigureOnSignal ¶ added in v1.10.0
func ReconfigureOnSignal(ctx context.Context, log logrus.FieldLogger, reconfigurer Reconfigurer) error
func ReconfigureTask ¶ added in v1.10.0
func ReconfigureTask(log logrus.FieldLogger, reconfigurer Reconfigurer) func(context.Context) error
Types ¶
type BuiltIn ¶ added in v1.0.0
type BuiltIn struct { Name string Plugin pluginsdk.PluginServer Services []pluginsdk.ServiceServer }
func MakeBuiltIn ¶ added in v1.0.0
func MakeBuiltIn(name string, pluginServer pluginsdk.PluginServer, serviceServers ...pluginsdk.ServiceServer) BuiltIn
type BuiltInConfig ¶ added in v1.0.0
type BuiltInConfig struct { // Log is the logger to be wired to the external plugin. Log logrus.FieldLogger // HostServices are the host service servers provided to the plugin. HostServices []pluginsdk.ServiceServer }
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
func Load ¶
Load loads and configures plugins defined in the configuration. The given catalog is populated with plugin and service facades for versions implemented by the loaded plugins. The returned io.Closer can be used to close down the loaded plugins, at which point, all facades bound to the given catalog are considered invalidated. If any plugin fails to load or configure, all plugins are unloaded, the catalog is cleared, and the function returns an error.
func (*Catalog) Reconfigure ¶ added in v1.10.0
type Config ¶
type Config struct { // Log is the logger. It is used for general purpose logging and also // provided to the plugins. Log logrus.FieldLogger // PluginConfigs is the list of plugin configurations. PluginConfigs []PluginConfig // HostServices are the servers for host services provided by SPIRE to // plugins. HostServices []pluginsdk.ServiceServer // CoreConfig is the core configuration provided to each plugin. CoreConfig CoreConfig }
type Configurer ¶ added in v1.0.0
type Configurer interface { Configure(ctx context.Context, coreConfig CoreConfig, configuration string) error Validate(ctx context.Context, coreConfig CoreConfig, configuration string) error }
type ConfigurerFunc ¶ added in v1.10.0
type ConfigurerFunc func(ctx context.Context, coreConfig CoreConfig, configuration string) error
func (ConfigurerFunc) Configure ¶ added in v1.10.0
func (fn ConfigurerFunc) Configure(ctx context.Context, coreConfig CoreConfig, configuration string) error
func (ConfigurerFunc) Validate ¶ added in v1.11.0
func (fn ConfigurerFunc) Validate(ctx context.Context, coreConfig CoreConfig, configuration string) error
type Constraints ¶ added in v1.0.0
type Constraints struct { // Min is the minimum number of plugins required of a specific type. If // zero, there is no lower bound (i.e. the plugin type is optional). Min int // Max is the maximum number of plugins required of a specific type. If // zero, there is no upper bound. Max int }
func AtLeastOne ¶ added in v1.0.0
func AtLeastOne() Constraints
func ExactlyOne ¶ added in v1.0.0
func ExactlyOne() Constraints
func MaybeOne ¶ added in v1.0.0
func MaybeOne() Constraints
func ZeroOrMore ¶ added in v1.0.0
func ZeroOrMore() Constraints
func (Constraints) Check ¶ added in v1.0.0
func (c Constraints) Check(count int) error
type CoreConfig ¶ added in v1.0.0
type CoreConfig struct {
TrustDomain spiffeid.TrustDomain
}
type DataSource ¶ added in v1.10.0
type Facade ¶ added in v1.0.0
type Facade interface { // ServiceClient is used to initialize the service client with the // connection to the plugin providing the service server. pluginsdk.ServiceClient // InitInfo is used to initialize the facade with information for the // loaded plugin providing the service server. InitInfo(info PluginInfo) // InitLog initializes the facade with the logger for the loaded plugin // that provides the service server. InitLog(log logrus.FieldLogger) }
Facade is a facade for a specific plugin or service version.
type Plugin ¶
type Plugin interface { // Closer is used to unload the plugin. Any facades initialized by the // call to bind are considered invalidated after the plugin is closed. io.Closer // Bind binds the given facades to the plugin. It also returns a Configurer // that can be used to configure the plugin. If the plugin does not support // a given facade, an error will be returned. This function is designed // only for use by unit-tests for built-in plugin implementations or fake // facade implementations that rely on built-ins. Bind(facades ...Facade) (Configurer, error) }
Plugin is a loaded plugin.
func LoadBuiltIn ¶ added in v1.0.0
type PluginConfig ¶
type PluginConfig struct { Type string Name string Path string Args []string Checksum string DataSource DataSource Disabled bool }
func (PluginConfig) IsEnabled ¶ added in v1.6.0
func (c PluginConfig) IsEnabled() bool
func (*PluginConfig) IsExternal ¶ added in v1.0.0
func (c *PluginConfig) IsExternal() bool
type PluginConfigs ¶ added in v1.6.0
type PluginConfigs []PluginConfig
func PluginConfigsFromHCLNode ¶ added in v1.6.0
func PluginConfigsFromHCLNode(pluginsNode ast.Node) (PluginConfigs, error)
func (PluginConfigs) FilterByType ¶ added in v1.6.0
func (cs PluginConfigs) FilterByType(pluginType string) (matching PluginConfigs, remaining PluginConfigs)
func (PluginConfigs) Find ¶ added in v1.6.0
func (cs PluginConfigs) Find(pluginType, pluginName string) (PluginConfig, bool)
type PluginInfo ¶
type PluginInfo interface { // The name of the plugin (e.g. "aws_iid"). Name() string // The type of the plugin (e.g. KeyManager). Type() string }
PluginInfo provides the information for the loaded plugin.
type PluginRepo ¶ added in v1.0.0
type PluginRepo interface { ServiceRepo // Constraints returns the constraints required by the plugin repository. // The Load function will ensure that these constraints are satisfied before // returning successfully. Constraints() Constraints // BuiltIns provides the list of built ins that are available for the // given plugin repository. BuiltIns() []BuiltIn }
PluginRepo is a repository of plugin facades for a given plugin type.
type Reconfigurable ¶ added in v1.10.0
type Reconfigurable struct { Log logrus.FieldLogger CoreConfig CoreConfig Configurer Configurer DataSource DataSource LastHash string }
func (*Reconfigurable) Reconfigure ¶ added in v1.10.0
func (r *Reconfigurable) Reconfigure(ctx context.Context)
type Reconfigurer ¶ added in v1.10.0
type Reconfigurers ¶ added in v1.10.0
type Reconfigurers []Reconfigurer
func (Reconfigurers) Reconfigure ¶ added in v1.10.0
func (rs Reconfigurers) Reconfigure(ctx context.Context)
type Repository ¶ added in v1.10.0
type Repository interface { // Plugins returns a map of plugin repositories, keyed by the plugin type. Plugins() map[string]PluginRepo // Services returns service repositories. Services() []ServiceRepo }
Repository is a set of plugin and service repositories.
type ServiceRepo ¶ added in v1.0.0
type ServiceRepo interface { // Binder returns a function that is used by the catalog system to "bind" // the facade returned by selected version to the repository. It MUST // return void and take a single argument of type X, where X can be // assigned to by any of the facade implementation types returned by the // provided versions (see Versions). Binder() any // Versions returns the versions supported by the repository, ordered by // most to least preferred. The first version supported by the plugin will // be used. When a deprecated version is bound, warning messaging will // recommend the first version in the list as a replacement, unless it is // also deprecated. Versions() []Version // Clear is called when loading fails to clear the repository of any // previously bound facades. Clear() }
ServiceRepo is a repository for service facades for a given service.
type Version ¶ added in v1.0.0
type Version interface { // New returns a new facade for this version. Instantiated facades are only // bound via the repo binder when they match a gRPC service name provided // by the plugin. New() Facade // Deprecated returns whether or not the version is deprecated. Deprecated() bool }
Version represents a plugin or service version. It is used to instantiate facades for the versions that are bound to the plugin or service repositories (see the Binder method on the ServiceRepo).