controller

package
v0.0.0-...-bfef3a7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrorReporterStackSize controls the depth of the LIFO error buffer.
	ErrorReporterStackSize int = 10

	// TrimPrefixSuffixLen contols the number of characters to retain at the prefix and the
	// suffix of long strings.
	TrimPrefixSuffixLen = 120
)
View Source
const WatcherBufferSize int = 1024

Variables

This section is empty.

Functions

func NewErrorReporter

func NewErrorReporter(errorChan chan error) *errorReporter

Types

type Controller

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

Controller is a dcontroller reconciler.

func New

func New(mgr runtimeManager.Manager, config opv1a1.Controller, opts Options) (*Controller, error)

New registers a new controller given by the source resource(s) the controller watches, a target resource the controller sends its output, and a processing pipeline to process the base resources into target resources.

func (*Controller) GetName

func (c *Controller) GetName() string

GetName returns the name of the controller.

func (*Controller) GetStatus

func (c *Controller) GetStatus(gen int64) opv1a1.ControllerStatus

func (*Controller) GetWatcher

func (c *Controller) GetWatcher() chan reconciler.Request

GetWatcher returns the channel that multiplexes the requests coming from the base resources.

func (Controller) IsCritical

func (s Controller) IsCritical() bool

func (Controller) IsEmpty

func (s Controller) IsEmpty() bool

func (Controller) Pop

func (s Controller) Pop()

func (Controller) Push

func (s Controller) Push(err error, critical bool) error

func (Controller) PushCriticalError

func (s Controller) PushCriticalError(err error) error

func (Controller) PushError

func (s Controller) PushError(err error) error

func (Controller) Report

func (s Controller) Report() []string

func (*Controller) ReportErrors

func (c *Controller) ReportErrors() []string

ReportErrors returns a short report on the error stack of the controller.

func (*Controller) SetPipeline

func (c *Controller) SetPipeline(pipeline pipeline.Evaluator)

SetPipeline overrides the pipeline of the controller. Useful for adding a custom pipeline to a controller.

func (Controller) Size

func (s Controller) Size() int

func (*Controller) Start

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

Start starts running the controller. The Start function blocks until the context is closed or an error occurs, and it will stop running when the context is closed.

func (Controller) String

func (s Controller) String() string

func (Controller) Top

func (s Controller) Top() error

type ControllerReconciler

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

ControllerReconciler is a generic reconciler that feeds the requests received from any of the sources into the controller processor pipeline.

func NewControllerReconciler

func NewControllerReconciler(mgr runtimeManager.Manager, c *Controller) *ControllerReconciler

func (*ControllerReconciler) Reconcile

type Options

type Options struct {
	// Processor allows to override the default request processor of the controller.
	Processor ProcessorFunc
	// ErrorChannel is a channel to receive errors from the controller.
	ErrorChan chan error
}

type ProcessorFunc

type ProcessorFunc func(ctx context.Context, c *Controller, req reconciler.Request) error

Jump to

Keyboard shortcuts

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