package discovery

import "github.com/open-policy-agent/opa/plugins/discovery"

Package discovery implements configuration discovery.

Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the github.com/open-policy-agent/opa/v1 package instead. See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.

Index

Constants

const (
	// Name is the discovery plugin name that will be registered with the plugin manager.
	Name = v1.Name
)

Functions

func BootConfig

func BootConfig(bootConfig map[string]interface{}) func(*Discovery)

func Factories

func Factories(fs map[string]plugins.Factory) func(*Discovery)

Factories provides a set of factory functions to use for instantiating custom plugins.

func Hooks

func Hooks(hs hooks.Hooks) func(*Discovery)

func Metrics

func Metrics(m metrics.Metrics) func(*Discovery)

Metrics provides a metrics provider to pass to plugins.

Types

type Config

type Config = v1.Config

Config represents the configuration for the discovery feature.

func ParseConfig

func ParseConfig(bs []byte, services []string) (*Config, error)

ParseConfig returns a valid Config object with defaults injected.

type ConfigBuilder

type ConfigBuilder = v1.ConfigBuilder

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

type Discovery

type Discovery = v1.Discovery

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

func Lookup(manager *plugins.Manager) *Discovery

Lookup returns the discovery plugin registered with the manager.

func New

func New(manager *plugins.Manager, opts ...func(*Discovery)) (*Discovery, error)

New returns a new discovery plugin.

Source Files

config.go discovery.go doc.go

Version
v1.4.2 (latest)
Published
May 2, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
5 hours ago

Tools for package owners.