controller

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 1,063

Documentation

Overview

Package controller provides utilties for working with controllers.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultNewCacheFn      NewCacheFn      = cache.New
	DefaultNewControllerFn NewControllerFn = controller.NewUnmanaged
)

The default new cache and new controller functions.

Functions

This section is empty.

Types

type Engine

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

An Engine manages the lifecycles of controller-runtime controllers (and their caches). The lifecycles of the controllers are not coupled to lifecycle of the engine, nor to the lifecycle of the controller manager it uses.

func NewEngine

func NewEngine(mgr manager.Manager, o ...EngineOption) *Engine

NewEngine produces a new Engine.

func (*Engine) Err

func (e *Engine) Err(name string) error

Err returns any error encountered by the named controller. The returned error is always nil if the named controller is running.

func (*Engine) IsRunning

func (e *Engine) IsRunning(name string) bool

IsRunning indicates whether the named controller is running - i.e. whether it has been started and does not appear to have crashed.

func (*Engine) Start

func (e *Engine) Start(name string, o controller.Options, w ...Watch) error

Start the named controller. Each controller is started with its own cache whose lifecycle is coupled to the controller. The controller is started with the supplied options, and configured with the supplied watches. Start does not block.

func (*Engine) Stop

func (e *Engine) Stop(name string)

Stop the named controller.

type EngineOption

type EngineOption func(*Engine)

An EngineOption configures an Engine.

func WithNewCacheFn

func WithNewCacheFn(fn NewCacheFn) EngineOption

WithNewCacheFn may be used to configure a different cache implementation. DefaultNewCacheFn is used by default.

func WithNewControllerFn

func WithNewControllerFn(fn NewControllerFn) EngineOption

WithNewControllerFn may be used to configure a different controller implementation. DefaultNewControllerFn is used by default.

type NewCacheFn

type NewCacheFn func(cfg *rest.Config, o cache.Options) (cache.Cache, error)

A NewCacheFn creates a new controller-runtime cache.

type NewControllerFn

type NewControllerFn func(name string, m manager.Manager, o controller.Options) (controller.Controller, error)

A NewControllerFn creates a new controller-runtime controller.

type Options added in v0.16.0

type Options struct {
	// The Logger controllers should use.
	Logger logging.Logger

	// The GlobalRateLimiter used by this controller manager. The rate of
	// reconciles across all controllers will be subject to this limit.
	GlobalRateLimiter workqueue.RateLimiter

	// PollInterval at which each controller should speculatively poll to
	// determine whether it has work to do.
	PollInterval time.Duration

	// MaxConcurrentReconciles for each controller.
	MaxConcurrentReconciles int

	// Features that should be enabled.
	Features *feature.Flags
}

Options frequently used by most Crossplane controllers.

func DefaultOptions added in v0.16.0

func DefaultOptions() Options

DefaultOptions returns a functional set of options with conservative defaults.

func (Options) ForControllerRuntime added in v0.16.0

func (o Options) ForControllerRuntime() controller.Options

ForControllerRuntime extracts options for controller-runtime.

type Watch

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

Watch an object.

func For

For returns a Watch for the supplied kind of object. Events will be handled by the supplied EventHandler, and may be filtered by the supplied predicates.

Jump to

Keyboard shortcuts

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