Documentation
¶
Overview ¶
Package controller provides utils for controller-runtime.
Index ¶
- type Builder
- func (blder *Builder) Build(r reconcile.TypedReconciler[reconcile.Request]) (Controller, error)
- func (blder *Builder) Complete(r reconcile.TypedReconciler[reconcile.Request]) error
- func (blder *Builder) For(object client.Object, opts ...builder.ForOption) *Builder
- func (blder *Builder) Named(name string) *Builder
- func (blder *Builder) Owns(object client.Object, predicates ...predicate.Predicate) *Builder
- func (blder *Builder) Watches(object client.Object, ...) *Builder
- func (blder *Builder) WatchesMetadata(object client.Object, ...) *Builder
- func (blder *Builder) WatchesRawSource(src source.TypedSource[reconcile.Request]) *Builder
- func (blder *Builder) WithEventFilter(p predicate.Predicate) *Builder
- func (blder *Builder) WithOptions(options controller.TypedOptions[reconcile.Request]) *Builder
- type Controller
- type FakeController
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 ¶
NewControllerManagedBy returns a new controller builder that will be started by the provided Manager.
func (*Builder) Build ¶
func (blder *Builder) Build(r reconcile.TypedReconciler[reconcile.Request]) (Controller, error)
Build builds the Application Controller and returns the Controller it created.
func (*Builder) For ¶
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 ¶
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 ¶
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 ¶
WatchesRawSource exposes the lower-level ControllerManagedBy Watches functions through the builder.
func (*Builder) WithEventFilter ¶
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)