controller

package
v1.12.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package controller provides utils for controller-runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder is a wrapper around controller-runtime's builder.Builder.

func NewControllerManagedBy

func NewControllerManagedBy(m manager.Manager, predicateLog logr.Logger) *Builder

NewControllerManagedBy returns a new controller builder that will be started by the provided Manager.

func (*Builder) Build

Build builds the Application Controller and returns the Controller it created.

func (*Builder) Complete

Complete builds the Application Controller.

func (*Builder) For

func (blder *Builder) For(object client.Object, opts ...builder.ForOption) *Builder

For defines the type of Object being *reconciled*, and configures the ControllerManagedBy to respond to create / delete / update events by *reconciling the object*.

func (*Builder) Named

func (blder *Builder) Named(name string) *Builder

Named sets the name of the controller to the given name. The name shows up in metrics, among other things, and thus should be a prometheus compatible name (underscores and alphanumeric characters only).

func (*Builder) Owns

func (blder *Builder) Owns(object client.Object, predicates ...predicate.Predicate) *Builder

Owns defines types of Objects being *generated* by the ControllerManagedBy, and configures the ControllerManagedBy to respond to create / delete / update events by *reconciling the owner object*.

func (*Builder) Watches

func (blder *Builder) Watches(object client.Object, eventHandler handler.TypedEventHandler[client.Object, reconcile.Request], predicates ...predicate.Predicate) *Builder

Watches defines the type of Object to watch, and configures the ControllerManagedBy to respond to create / delete / update events by *reconciling the object* with the given EventHandler.

func (*Builder) WatchesMetadata

func (blder *Builder) WatchesMetadata(object client.Object, eventHandler handler.TypedEventHandler[client.Object, reconcile.Request],
	predicates ...predicate.Predicate) *Builder

WatchesMetadata is the same as Watches, but forces the internal cache to only watch PartialObjectMetadata.

func (*Builder) WatchesRawSource

func (blder *Builder) WatchesRawSource(src source.TypedSource[reconcile.Request]) *Builder

WatchesRawSource exposes the lower-level ControllerManagedBy Watches functions through the builder.

func (*Builder) WithEventFilter

func (blder *Builder) WithEventFilter(p predicate.Predicate) *Builder

WithEventFilter sets the event filters, to filter which create/update/delete/generic events eventually trigger reconciliations. For example, filtering on whether the resource version has changed.

func (*Builder) WithOptions

func (blder *Builder) WithOptions(options controller.TypedOptions[reconcile.Request]) *Builder

WithOptions overrides the controller options used in doController. Defaults to empty.

type Controller

type Controller interface {
	controller.Controller
	DeferNextReconcile(req reconcile.Request, reconcileAfter time.Time)
	DeferNextReconcileForObject(obj metav1.Object, reconcileAfter time.Time)
}

Controller is the controller-runtime Controller interface with additional methods to defer the next reconcile for a request / object.

type FakeController

type FakeController struct {
	controller.Controller
	Deferrals map[reconcile.Request]time.Time
}

func NewFakeController

func NewFakeController() *FakeController

func (*FakeController) DeferNextReconcile

func (f *FakeController) DeferNextReconcile(req reconcile.Request, reconcileAfter time.Time)

func (*FakeController) DeferNextReconcileForObject

func (f *FakeController) DeferNextReconcileForObject(obj metav1.Object, reconcileAfter time.Time)

Jump to

Keyboard shortcuts

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