discovery

package
v0.63.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 26 Imported by: 14

Documentation

Overview

Package discovery implements configuration discovery.

Index

Constants

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

Variables

This section is empty.

Functions

func Factories added in v0.10.3

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

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

func Hooks added in v0.54.0

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

func Metrics added in v0.14.0

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

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

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

ParseConfig returns a valid Config object with defaults injected.

type ConfigBuilder added in v0.22.0

type ConfigBuilder struct {
	// contains filtered or unexported fields
}

ConfigBuilder assists in the construction of the plugin configuration.

func NewConfigBuilder added in v0.22.0

func NewConfigBuilder() *ConfigBuilder

NewConfigBuilder returns a new ConfigBuilder to build and parse the discovery config

func (*ConfigBuilder) Parse added in v0.22.0

func (b *ConfigBuilder) Parse() (*Config, error)

Parse returns a valid Config object with defaults injected.

func (*ConfigBuilder) WithBytes added in v0.22.0

func (b *ConfigBuilder) WithBytes(config []byte) *ConfigBuilder

WithBytes sets the raw discovery config

func (*ConfigBuilder) WithKeyConfigs added in v0.22.0

func (b *ConfigBuilder) WithKeyConfigs(keys map[string]*keys.Config) *ConfigBuilder

WithKeyConfigs sets the public keys to verify a signed bundle

func (*ConfigBuilder) WithServices added in v0.22.0

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 added in v0.32.0

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.

func (*Discovery) Reconfigure

func (*Discovery) Reconfigure(context.Context, interface{})

Reconfigure is a no-op on discovery.

func (*Discovery) RegisterListener added in v0.32.0

func (c *Discovery) RegisterListener(name interface{}, f func(bundle.Status))

func (*Discovery) Start

func (c *Discovery) Start(ctx context.Context) error

Start starts the dynamic discovery process if configured.

func (*Discovery) Stop

func (c *Discovery) Stop(ctx context.Context)

Stop stops the dynamic discovery process if configured.

func (*Discovery) Trigger added in v0.32.0

func (c *Discovery) Trigger(ctx context.Context) error

func (*Discovery) TriggerMode added in v0.32.0

func (c *Discovery) TriggerMode() *plugins.TriggerMode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL