mapper

package
v1.82.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnqueueRequestsFrom

func EnqueueRequestsFrom(ctx context.Context, cache cache.Cache, m Mapper, updateBehavior UpdateBehavior, log logr.Logger) 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 behavior on UpdateEvents. For UpdateEvents, the given UpdateBehavior decides if only the old, only the new or both objects should be mapped and enqueued.

func ObjectListToRequests added in v1.52.0

func ObjectListToRequests(list client.ObjectList, predicates ...func(client.Object) bool) []reconcile.Request

ObjectListToRequests adds a reconcile.Request for each object in the provided list.

Types

type MapFunc

type MapFunc func(ctx context.Context, log logr.Logger, reader client.Reader, obj 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(ctx context.Context, log logr.Logger, reader client.Reader, obj client.Object) []reconcile.Request

Map implements Mapper.

type Mapper

type Mapper interface {
	// Map maps an object
	Map(ctx context.Context, log logr.Logger, reader client.Reader, obj client.Object) []reconcile.Request
}

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

func ClusterToObjectMapper

func ClusterToObjectMapper(mgr manager.Manager, 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