Documentation ¶
Index ¶
- type Builder
- func (b *Builder[T, Obj]) Build() SetupFunc
- func (b *Builder[T, Obj]) Manages(gvks ...schema.GroupVersionKind) *Builder[T, Obj]
- func (b *Builder[T, Obj]) Watches(object client.Object, handler handler.EventHandler, ...) *Builder[T, Obj]
- func (b *Builder[T, Obj]) WatchesRawSource(src source.Source) *Builder[T, Obj]
- func (b *Builder[T, Obj]) WatchesRemoteKind(cache cache.Cache, obj client.Object, handler handler.EventHandler, ...) *Builder[T, Obj]
- func (b *Builder[T, Obj]) WithControllerHandle(fn ControllerFunc) *Builder[T, Obj]
- func (b *Builder[T, Obj]) WithEventFilter(predicate predicate.Predicate) *Builder[T, Obj]
- func (b *Builder[T, Obj]) WithFinalizerState(state *fsmtypes.State[Obj]) *Builder[T, Obj]
- func (b *Builder[T, Obj]) WithMaxConcurrentReconciles(maxConcurrentReconciles int) *Builder[T, Obj]
- func (b *Builder[T, Obj]) WithReconcilerOptions(reconcilerOptions fsmtypes.ReconcilerOptions[T, Obj]) *Builder[T, Obj]
- type ClaimBuilder
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) BeforeDelete(beforeDelete internal.BeforeDelete[T, ClaimedType, U, ClaimType]) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) Build() SetupFunc
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) Manages(gvks ...schema.GroupVersionKind) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) Watches(object client.Object, handler handler.EventHandler, ...) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WatchesRawSource(src source.Source) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WatchesRemoteKind(cache cache.Cache, obj client.Object, handler handler.EventHandler, ...) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WithControllerHandle(fn ControllerFunc) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WithEventFilter(predicate predicate.Predicate) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WithFinalizerState(state *types.State[ClaimedType]) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WithMaxConcurrentReconciles(maxConcurrentReconciles int) *ClaimBuilder[T, U, ClaimedType, ClaimType]
- type ControllerFunc
- type SetupFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder[T any, Obj apitypes.FSMResource[T]] struct { // contains filtered or unexported fields }
Builder is a builder for an FSM controller.
func NewBuilder ¶
func NewBuilder[T any, Obj apitypes.FSMResource[T]]( obj Obj, initialState *fsmtypes.State[Obj], scheme *runtime.Scheme, ) *Builder[T, Obj]
NewBuilder returns a builder that builds a function wiring up a logical FSM controller to a manager. Obj is the object being reconciled and initialState is the initial state in the finite state machine,
func (*Builder[T, Obj]) Manages ¶
func (b *Builder[T, Obj]) Manages( gvks ...schema.GroupVersionKind, ) *Builder[T, Obj]
Manages adds a managed resource type to the controller. All resource types that the controller manages must be included.
func (*Builder[T, Obj]) Watches ¶
func (b *Builder[T, Obj]) Watches( object client.Object, handler handler.EventHandler, triggerType fsmhandler.TriggerType, opts ...ctrlbuilder.WatchesOption, ) *Builder[T, Obj]
Watches adds a custom watch to the controller.
func (*Builder[T, Obj]) WatchesRawSource ¶
WatchesRawSource adds a new watch to the controller for events originating outside the cluster.
This watch doesn't wrap the event handler with the FSM handler, so it's up to the caller to do so. You can use the fsmhandler.NewObservedEventHandler to wrap the handler with the FSM handler.
func (*Builder[T, Obj]) WatchesRemoteKind ¶ added in v0.13.0
func (b *Builder[T, Obj]) WatchesRemoteKind( cache cache.Cache, obj client.Object, handler handler.EventHandler, triggerType fsmhandler.TriggerType, predicates ...predicate.Predicate, ) *Builder[T, Obj]
WatchesRemoteKind adds a new watch to the controller for a specific kind located in a remote cluster. The remote cluster is specified through cache.Cache.
func (*Builder[T, Obj]) WithControllerHandle ¶
func (b *Builder[T, Obj]) WithControllerHandle(fn ControllerFunc) *Builder[T, Obj]
WithControllerHandle adds a ControllerFunc.
func (*Builder[T, Obj]) WithEventFilter ¶
WithEventFilter adds a custom event filter to the controller.
func (*Builder[T, Obj]) WithFinalizerState ¶
WithFinalizerState adds an optional finalizer state, guaranteed to be executed after a deletion has been issued for the object and before the object is deleted from kubernetes.
func (*Builder[T, Obj]) WithMaxConcurrentReconciles ¶
WithMaxConcurrentReconciles sets the maxConcurrentReconciles option for controller-runtime. Defaults to 1 if not specified or when a value <= 0 is passed. controller-runtime ensures a single object is not reconciled by multiple reconcilers concurrently. If your controller manages global state (e.g. caches attached to the controller struct), you need to ensure it is thread safe before increasing the concurrency.
func (*Builder[T, Obj]) WithReconcilerOptions ¶
func (b *Builder[T, Obj]) WithReconcilerOptions(reconcilerOptions fsmtypes.ReconcilerOptions[T, Obj]) *Builder[T, Obj]
WithReconcilerOptions sets reconciler options.
type ClaimBuilder ¶
type ClaimBuilder[T any, U any, ClaimedType apitypes.ClaimedType[T], ClaimType apitypes.ClaimType[U]] struct { // contains filtered or unexported fields }
ClaimBuilder is a builder for an FSM controller managing a pair of claimed and claim resources.
func NewClaimBuilder ¶
func NewClaimBuilder[T any, U any, ClaimedType apitypes.ClaimedType[T], ClaimType apitypes.ClaimType[U]]( obj ClaimedType, claim ClaimType, initialState *types.State[ClaimedType], scheme *runtime.Scheme, ) *ClaimBuilder[T, U, ClaimedType, ClaimType]
NewClaimBuilder returns a builder that builds a function wiring up a logical FSM controller to a manager. Obj is the object being reconciled and initialState is the initial state in the finite state machine,
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) BeforeDelete ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) BeforeDelete( beforeDelete internal.BeforeDelete[T, ClaimedType, U, ClaimType], ) *ClaimBuilder[T, U, ClaimedType, ClaimType]
BeforeDelete adds a hook to perform custom actions before claimed resource is deleted. Claimed resource won't be deleted as long as hook returns error.
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) Build ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) Build() SetupFunc
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) Manages ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) Manages( gvks ...schema.GroupVersionKind, ) *ClaimBuilder[T, U, ClaimedType, ClaimType]
Manages adds a managed resource type to the controller. All resource types that the controller manages must be included.
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) Watches ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) Watches( object client.Object, handler handler.EventHandler, triggerType fsmhandler.TriggerType, opts ...ctrlbuilder.WatchesOption, ) *ClaimBuilder[T, U, ClaimedType, ClaimType]
Watches adds a custom watch to the controller.
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) WatchesRawSource ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WatchesRawSource(src source.Source) *ClaimBuilder[T, U, ClaimedType, ClaimType]
WatchesRawSource adds a new watch to the controller for events originating outside the cluster.
This watch doesn't wrap the event handler with the FSM handler, so it's up to the caller to do so. You can use the fsmhandler.NewObservedEventHandler to wrap the handler with the FSM handler.
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) WatchesRemoteKind ¶ added in v0.13.0
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WatchesRemoteKind( cache cache.Cache, obj client.Object, handler handler.EventHandler, triggerType fsmhandler.TriggerType, predicates ...predicate.Predicate, ) *ClaimBuilder[T, U, ClaimedType, ClaimType]
WatchesRemoteKind adds a new watch to the controller for a specific kind located in a remote cluster. The remote cluster is specified through cache.Cache.
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) WithControllerHandle ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WithControllerHandle(fn ControllerFunc) *ClaimBuilder[T, U, ClaimedType, ClaimType]
WithControllerHandle adds a ControllerFunc.
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) WithEventFilter ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WithEventFilter( predicate predicate.Predicate, ) *ClaimBuilder[T, U, ClaimedType, ClaimType]
WithEventFilter adds a custom event filter to the controller.
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) WithFinalizerState ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WithFinalizerState(state *types.State[ClaimedType]) *ClaimBuilder[T, U, ClaimedType, ClaimType]
WithFinalizerState adds an optional finalizer state, guaranteed to be executed after a deletion has been issued for the object and before the object is deleted from kubernetes.
func (*ClaimBuilder[T, U, ClaimedType, ClaimType]) WithMaxConcurrentReconciles ¶
func (b *ClaimBuilder[T, U, ClaimedType, ClaimType]) WithMaxConcurrentReconciles(maxConcurrentReconciles int) *ClaimBuilder[T, U, ClaimedType, ClaimType]
WithMaxConcurrentReconciles sets the maxConcurrentReconciles option for controller-runtime. Defaults to 1 if not specified or when a value <= 0 is passed. controller-runtime ensures a single object is not reconciled by multiple reconcilers concurrently. If your controller manages global state (e.g. caches attached to the controller struct), you need to ensure it is thread safe before increasing the concurrency.
type ControllerFunc ¶
type ControllerFunc func(controller.Controller)
ControllerFunc is a function with a handle to a controller.Controller. Typically used in cases where watches need to be initiated dynamically at run time.