Documentation ¶
Overview ¶
Package cleanup provides a generic implementation of controller which waits for and cleans up resources.
Index ¶
- type Controller
- type Handler
- func Combine[I generic.ResourceWithRD](handlers ...Handler[I]) Handler[I]
- func HasNoOutputs[O generic.ResourceWithRD, I generic.ResourceWithRD](listOptions func(I) state.ListOption) Handler[I]
- func RemoveOutputs[O generic.ResourceWithRD, I generic.ResourceWithRD](listOptions func(I) state.ListOption, opts ...RemoveOutputsOption) Handler[I]
- type RemoveOutputsOption
- type RemoveOutputsOptions
- type Settings
- type SkipReconcileTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller[I generic.ResourceWithRD] struct { generic.NamedController // contains filtered or unexported fields }
Controller is a cleanup controller.
func NewController ¶
func NewController[I generic.ResourceWithRD]( settings Settings[I], ) *Controller[I]
NewController returns a new cleanup controller.
func (*Controller[I]) Inputs ¶
func (ctrl *Controller[I]) Inputs() []controller.Input
Inputs implements controller.Controller interface.
func (*Controller[I]) Outputs ¶
func (ctrl *Controller[I]) Outputs() []controller.Output
Outputs implements controller.Controller interface.
func (*Controller[I]) Run ¶
func (ctrl *Controller[I]) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error
Run implements controller.Controller interface.
type Handler ¶
type Handler[Input generic.ResourceWithRD] interface { FinalizerRemoval(context.Context, controller.Runtime, *zap.Logger, Input) error Inputs() []controller.Input Outputs() []controller.Output }
Handler is a set of callbacks for the controller. It is implemented this way, because callbacks are related to each other, and it is easier to pass and understand them as a single object.
func Combine ¶
func Combine[I generic.ResourceWithRD]( handlers ...Handler[I], ) Handler[I]
Combine is a helper function to create a Handler that combines multiple handlers.
func HasNoOutputs ¶
func HasNoOutputs[O generic.ResourceWithRD, I generic.ResourceWithRD]( listOptions func(I) state.ListOption, ) Handler[I]
HasNoOutputs is a helper function to create a Handler that waits for all outputs to be removed.
func RemoveOutputs ¶
func RemoveOutputs[O generic.ResourceWithRD, I generic.ResourceWithRD]( listOptions func(I) state.ListOption, opts ...RemoveOutputsOption, ) Handler[I]
RemoveOutputs is a helper function to create a Handler that removes all outputs on input teardown. It ignores resource ownership using controller.IgnoreOwner.
type RemoveOutputsOption ¶ added in v0.3.18
type RemoveOutputsOption func(options *RemoveOutputsOptions)
RemoveOutputsOption defines the function for passing optional arguments to the RemoveOutputs handler.
func WithExtraOwners ¶ added in v0.3.18
func WithExtraOwners(owners ...string) RemoveOutputsOption
WithExtraOwners enables destroy for the resources which have the specified owners.
type RemoveOutputsOptions ¶ added in v0.3.18
type RemoveOutputsOptions struct {
// contains filtered or unexported fields
}
RemoveOutputsOptions optional config for the RemoveOutputs handler constructor.
type Settings ¶
type Settings[Input generic.ResourceWithRD] struct { // Name is the name of the controller. Name string // Handler is the handler for the controller. Handler Handler[Input] }
Settings configures the controller.
type SkipReconcileTag ¶
type SkipReconcileTag struct{}
SkipReconcileTag is used to tag errors when reconciliation should be skipped without an error.
It's useful when next reconcile event should bring things into order.