mapper

package
v1.35.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnqueueRequestsFrom

func EnqueueRequestsFrom(m Mapper, updateBehavior UpdateBehavior) handler.EventHandler

EnqueueRequestsFrom is similar to controller-runtime's mapper.EnqueueRequestsFromMapFunc. Instead of taking only a MapFunc it also allows passing a Mapper interface. Also, it allows customizing the behaviour on UpdateEvents. For UpdateEvents, the given UpdateBehaviour decides if only the old, only the new or both objects should be mapped and enqueued.

Types

type MapFunc

type MapFunc func(client.Object) []reconcile.Request

MapFunc is the signature required for enqueueing requests from a generic function. This type is usually used with EnqueueRequestsFromMapFunc when registering an event mapper.

func (MapFunc) Map

func (f MapFunc) Map(obj client.Object) []reconcile.Request

Map implements Mapper.

type Mapper

type Mapper interface {
	// Map maps an object
	Map(obj client.Object) []reconcile.Request
}

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

func ClusterToObjectMapper

func ClusterToObjectMapper(newObjListFunc func() client.ObjectList, predicates []predicate.Predicate) Mapper

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

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