package discovery
import "github.com/open-policy-agent/opa/v1/plugins/discovery"
Package discovery implements configuration discovery.
Index ¶
- Constants
- func BootConfig(bootConfig map[string]interface{}) func(*Discovery)
- func Factories(fs map[string]plugins.Factory) func(*Discovery)
- func Hooks(hs hooks.Hooks) func(*Discovery)
- func Metrics(m metrics.Metrics) func(*Discovery)
- type Config
- type ConfigBuilder
- func NewConfigBuilder() *ConfigBuilder
- func (b *ConfigBuilder) Parse() (*Config, error)
- func (b *ConfigBuilder) WithBytes(config []byte) *ConfigBuilder
- func (b *ConfigBuilder) WithKeyConfigs(keys map[string]*keys.Config) *ConfigBuilder
- func (b *ConfigBuilder) WithServices(services []string) *ConfigBuilder
- type Discovery
- func Lookup(manager *plugins.Manager) *Discovery
- func New(manager *plugins.Manager, opts ...func(*Discovery)) (*Discovery, error)
- func (*Discovery) Reconfigure(context.Context, interface{})
- func (c *Discovery) RegisterListener(name interface{}, f func(bundle.Status))
- func (c *Discovery) Start(ctx context.Context) error
- func (c *Discovery) Stop(ctx context.Context)
- func (c *Discovery) Trigger(ctx context.Context) error
- func (c *Discovery) TriggerMode() *plugins.TriggerMode
- func (c *Discovery) Unregister(name interface{})
Constants ¶
const ( // Name is the discovery plugin name that will be registered with the plugin manager. Name = "discovery" )
Functions ¶
func BootConfig ¶
func Factories ¶
Factories provides a set of factory functions to use for instantiating custom plugins.
func Hooks ¶
func Metrics ¶
Metrics provides a metrics provider to pass to plugins.
Types ¶
type Config ¶
type Config struct { download.Config // bundle downloader configuration Name *string `json:"name"` // Deprecated: name of the discovery bundle, use `Resource` instead. Prefix *string `json:"prefix,omitempty"` // Deprecated: use `Resource` instead. Decision *string `json:"decision"` // the name of the query to run on the bundle to get the config Service string `json:"service"` // the name of the service used to download discovery bundle from Resource *string `json:"resource,omitempty"` // the resource path which will be downloaded from the service Signing *bundle.VerificationConfig `json:"signing,omitempty"` // configuration used to verify a signed bundle Persist bool `json:"persist"` // control whether to persist activated discovery bundle to disk // contains filtered or unexported fields }
Config represents the configuration for the discovery feature.
func ParseConfig ¶
ParseConfig returns a valid Config object with defaults injected.
type ConfigBuilder ¶
type ConfigBuilder struct {
// contains filtered or unexported fields
}
ConfigBuilder assists in the construction of the plugin configuration.
func NewConfigBuilder ¶
func NewConfigBuilder() *ConfigBuilder
NewConfigBuilder returns a new ConfigBuilder to build and parse the discovery config
func (*ConfigBuilder) Parse ¶
func (b *ConfigBuilder) Parse() (*Config, error)
Parse returns a valid Config object with defaults injected.
func (*ConfigBuilder) WithBytes ¶
func (b *ConfigBuilder) WithBytes(config []byte) *ConfigBuilder
WithBytes sets the raw discovery config
func (*ConfigBuilder) WithKeyConfigs ¶
func (b *ConfigBuilder) WithKeyConfigs(keys map[string]*keys.Config) *ConfigBuilder
WithKeyConfigs sets the public keys to verify a signed bundle
func (*ConfigBuilder) WithServices ¶
func (b *ConfigBuilder) WithServices(services []string) *ConfigBuilder
WithServices sets the services that implement control plane APIs
type Discovery ¶
type Discovery struct {
// contains filtered or unexported fields
}
Discovery implements configuration discovery for OPA. When discovery is started it will periodically download a configuration bundle and try to reconfigure the OPA.
func Lookup ¶
Lookup returns the discovery plugin registered with the manager.
func New ¶
New returns a new discovery plugin.
func (*Discovery) Reconfigure ¶
Reconfigure is a no-op on discovery.
func (*Discovery) RegisterListener ¶
func (*Discovery) Start ¶
Start starts the dynamic discovery process if configured.
func (*Discovery) Stop ¶
Stop stops the dynamic discovery process if configured.
func (*Discovery) Trigger ¶
func (*Discovery) TriggerMode ¶
func (c *Discovery) TriggerMode() *plugins.TriggerMode
func (*Discovery) Unregister ¶
func (c *Discovery) Unregister(name interface{})
Unregister a listener to stop receiving status updates.
Source Files ¶
- Version
- v1.4.2 (latest)
- Published
- May 2, 2025
- Platform
- linux/amd64
- Imports
- 27 packages
- Last checked
- 5 hours ago –
Tools for package owners.