indexer

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListOwnedBy added in v0.22.0

func ListOwnedBy(ctx context.Context, client ctrlclient.Client, list ctrlclient.ObjectList, nn types.NamespacedName, ownerType metav1.TypeMeta) error

List all the objects owned by the given object type.

This allows us to use owner-based indexing in tests without incurring the overhead of caching.

See discussion here: https://github.com/tilt-dev/tilt/issues/4719

func StartSourceForTesting added in v0.23.6

func StartSourceForTesting(ctx context.Context, s source.Source, reconciler reconciler)

Types

type Indexer

type Indexer struct {
	// contains filtered or unexported fields
}

Helper struct to help reconcilers determine when to start their objects when a dependency triggers.

func NewIndexer

func NewIndexer(scheme *runtime.Scheme, keyFuncs ...KeyFunc) *Indexer

func (*Indexer) AddKeyFunc added in v0.23.0

func (m *Indexer) AddKeyFunc(fn KeyFunc)

AddKeyFunc registers a new indexer function.

In practice, all KeyFunc indexer functions should be added before or during controller initialization to avoid missed updates.

func (*Indexer) Enqueue

func (m *Indexer) Enqueue(obj client.Object) []reconcile.Request

Given an update of a watched object, return the names of objects watching it that we need to reconcile.

func (*Indexer) EnqueueKey

func (m *Indexer) EnqueueKey(key Key) []reconcile.Request

Enqueue() when we don't have the full object, only the name and kind.

func (*Indexer) OnReconcile

func (m *Indexer) OnReconcile(name types.NamespacedName, obj client.Object)

Register the watched object for the given primary object.

type Key

type Key struct {
	Name types.NamespacedName
	GVK  schema.GroupVersionKind
}

A key to help index objects we watch.

type KeyFunc

type KeyFunc func(obj client.Object) []Key

type Requeuer added in v0.23.5

type Requeuer struct {
	// contains filtered or unexported fields
}

Small helper class for triggering a Reconcile() from a goroutine.

func NewRequeuer added in v0.23.5

func NewRequeuer() *Requeuer

func (*Requeuer) Add added in v0.23.5

func (s *Requeuer) Add(nn types.NamespacedName)

func (*Requeuer) Start added in v0.23.5

Jump to

Keyboard shortcuts

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