Documentation ¶
Index ¶
- func Add(mgr manager.Manager, args AddArgs) error
- func DefaultPredicates() []predicate.Predicate
- func MapFuncFromMapper(mapper Mapper) handler.MapFunc
- func NewOwnedObjectPredicate(ownerType client.Object, reader client.Reader, ownerMapper Mapper, ...) predicate.Predicate
- func NewReconciler(actuator Actuator, controllerName, finalizerName string, typ client.Object, ...) reconcile.Reconciler
- type Actuator
- type AddArgs
- type Mapper
- type ObjectLabeler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPredicates ¶
DefaultPredicates returns the default predicates for a reconciler.
func MapFuncFromMapper ¶ added in v0.9.0
MapFuncFromMapper returns handler.MapFunc that uses the given mapper to map the given object to the object key of a different object and returns a reconcile.Request for that key if it's not empty.
func NewOwnedObjectPredicate ¶ added in v0.9.0
func NewOwnedObjectPredicate(ownerType client.Object, reader client.Reader, ownerMapper Mapper, finalizer string, logger logr.Logger) predicate.Predicate
NewOwnedObjectPredicate creates a new predicate that filters only relevant owned object events, such as creating or updating an object without an owner or with an owner that is being deleted, or deleting an object with an owner that is not being deleted.
Types ¶
type Actuator ¶
type Actuator interface { // CreateOrUpdate reconciles object creation or update. CreateOrUpdate(context.Context, client.Object) (time.Duration, error) // Delete reconciles object deletion. Delete(context.Context, client.Object) (time.Duration, error) // ShouldFinalize returns true if the object should be finalized. ShouldFinalize(context.Context, client.Object) (bool, error) }
Actuator acts upon objects being reconciled by a Reconciler.
type AddArgs ¶
type AddArgs struct { // Actuator is an actuator. Actuator Actuator // ControllerName is the name of the controller. ControllerName string // FinalizerName is the finalizer name. FinalizerName string // ControllerOptions are the controller options to use when creating a controller. // The Reconciler field is always overridden with a reconciler created from the given actuator. ControllerOptions controller.Options // Type is the object type to watch. Type client.Object // ShouldEnsureDeleted specifies that the controller should ensure the object is properly deleted on not found. ShouldEnsureDeleted bool // Predicates are the predicates to use when watching objects. Predicates []predicate.Predicate // WatchBuilder defines additional watches that should be set up. WatchBuilder extensionscontroller.WatchBuilder }
AddArgs are arguments for adding a controller to a manager.
type Mapper ¶ added in v0.9.0
type Mapper interface { // Map maps the given object to the object key of a different object. Map(obj client.Object) client.ObjectKey }
Mapper maps an object to the object key of a different object.
func NewLabelMapper ¶ added in v0.9.0
func NewLabelMapper(objectLabeler ObjectLabeler, label string) Mapper
NewLabelMapper creates a mapper that uses GetNamespacedName of the given ObjectLabeler with the given label.
type ObjectLabeler ¶ added in v0.9.0
type ObjectLabeler interface { // GetLabelValue returns a label value that uniquely identifies the given object. GetLabelValue(obj client.Object) string // GetNamespacedName returns types.NamespacedName from the given label value. GetNamespacedName(labelValue string) types.NamespacedName }
ObjectLabeler provides methods for creating a label value that uniquely identifies an object, as well as creating a namespaced name from such a label value.
func NewClusterObjectLabeler ¶ added in v0.9.0
func NewClusterObjectLabeler() ObjectLabeler
NewClusterObjectLabeler creates an ObjectLabeler that is appropriate for cluster objects. It uses the object name as the label value.
func NewNamespacedObjectLabeler ¶ added in v0.9.0
func NewNamespacedObjectLabeler(separator string) ObjectLabeler
NewNamespacedObjectLabeler creates an ObjectLabeler that is appropriate for namespaced objects. It uses the object namespace and name separated by the given separator as the label value.