handler

package
v1.12.7 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterToObjectMapper

func ClusterToObjectMapper(newObjListFunc func() runtime.Object, predicates []predicate.Predicate) handler.Mapper

ClusterToObjectMapper returns a mapper that returns requests for objects whose referenced clusters have been modified.

Types

type EnqueueRequestsFromMapFunc

type EnqueueRequestsFromMapFunc struct {
	// Mapper transforms the argument into a slice of keys to be reconciled
	ToRequests Mapper
}

EnqueueRequestsFromMapFunc enqueues Requests by running a transformation function that outputs a collection of reconcile.Requests on each Event. The reconcile.Requests may be for an arbitrary set of objects defined by some user specified transformation of the source Event. (e.g. trigger Reconciler for a set of objects in response to a cluster resize event caused by adding or deleting a Node)

EnqueueRequestsFromMapFunc is frequently used to fan-out updates from one object to one or more other objects of a differing type.

func (*EnqueueRequestsFromMapFunc) Create

Create implements EventHandler

func (*EnqueueRequestsFromMapFunc) Delete

Delete implements EventHandler

func (*EnqueueRequestsFromMapFunc) Generic

Generic implements EventHandler

func (*EnqueueRequestsFromMapFunc) InjectFunc

func (e *EnqueueRequestsFromMapFunc) InjectFunc(f inject.Func) error

InjectFunc implements Injector.

func (*EnqueueRequestsFromMapFunc) Update

Update implements EventHandler

type MapCreateObject

type MapCreateObject struct {
	// Meta is the meta data for an object from an event.
	Meta metav1.Object

	// Object is the object from an event.
	Object runtime.Object
}

MapCreateObject contains information from a create event to be transformed into a Request.

type MapDeleteObject

type MapDeleteObject struct {
	// Meta is the meta data for an object from an event.
	Meta metav1.Object

	// Object is the object from an event.
	Object runtime.Object
}

MapDeleteObject contains information from a delete event to be transformed into a Request.

type MapGenericObject

type MapGenericObject struct {
	// Meta is the meta data for an object from an event.
	Meta metav1.Object

	// Object is the object from an event.
	Object runtime.Object
}

MapGenericObject contains information from a generic event to be transformed into a Request.

type MapUpdateObject

type MapUpdateObject struct {
	// MetaOld is the old meta data for an object from an update event.
	MetaOld metav1.Object
	// ObjectOld is the old object from an update event.
	ObjectOld runtime.Object

	// MetaNew is the new meta data for an object from an update event.
	MetaNew metav1.Object
	// ObjectNew is the new object from an update event.
	ObjectNew runtime.Object
}

MapUpdateObject contains information from an update event to be transformed into a Request.

type Mapper

type Mapper interface {
	// Map maps an object for a create event.
	MapCreate(MapCreateObject) []reconcile.Request
	// Map maps an object for a delete event.
	MapDelete(MapDeleteObject) []reconcile.Request
	// Map maps an object for a generic event.
	MapGeneric(MapGenericObject) []reconcile.Request
	// Map maps an object for an update event.
	MapUpdate(MapUpdateObject) []reconcile.Request
}

Mapper maps an object to a collection of keys to be enqueued

func SimpleMapper

func SimpleMapper(mapper handler.Mapper, updateBehavior UpdateBehavior) Mapper

SimpleMapper wraps a mapper and calls its update function according to the given `updateBehavior`.

type UpdateBehavior

type UpdateBehavior uint8

UpdateBehavior determines how an update should be handled.

const (
	// UpdateWithOldAndNew considers both, the old as well as the new object, in case of an update.
	UpdateWithOldAndNew UpdateBehavior = iota
	// UpdateWithOld considers only the old object in case of an update.
	UpdateWithOld
	// UpdateWithNew considers only the new object in case of an update.
	UpdateWithNew
)

Jump to

Keyboard shortcuts

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