predicate

package
v1.21.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtractorFunc

type ExtractorFunc[T, U metav1.Object] func(obj U) Func[T]

An ExtractorFunc applies a transformation to a runtime.Object and creates a predicate function based on the result of the transformation. This can be used to apply complex lookup logic to determine which resources should be enqueued if another resource being watched changes, for example, enqueuing all Certificate resources that own a CertificateRequest that has been observed, or enqueuing all Certificate resources that specify `status.nextPrivateKeySecretName` as the name of the Secret being processed. ExtractorFunc builds a predicate.Func for the target type based on the provided object (usually the object from a watch event).

func ExtractResourceName

func ExtractResourceName[U, T metav1.Object](p func(name string) Func[T]) ExtractorFunc[T, U]

ExtractResourceName is a helper function used to extract a name from a metav1.Object being enqueued to construct a Func that is variadic based on a string value.

type Func

type Func[T metav1.Object] func(obj T) bool

Func is a generic function used to filter various types of resources.

func CertificateNextPrivateKeySecretName

func CertificateNextPrivateKeySecretName(name string) Func[*cmapi.Certificate]

CertificateNextPrivateKeySecretName returns a predicate that used to filter Certificates to only those with the given 'status.nextPrivateKeySecretName'. It is not possible to select Certificates with a 'nil' secret name using this predicate function.

func CertificateRequestRevision

func CertificateRequestRevision(revision int) Func[*cmapi.CertificateRequest]

CertificateRequestRevision returns a predicate that used to filter CertificateRequest to only those with a given 'revision' number.

func CertificateSecretName

func CertificateSecretName(name string) Func[*cmapi.Certificate]

CertificateSecretName returns a predicate that used to filter Certificates to only those with the given 'spec.secretName'.

func ResourceOwnedBy

func ResourceOwnedBy[T, U metav1.Object](ownerObj U) Func[T]

ResourceOwnedBy will filter returned results to only those with the given resource as an owner.

func ResourceOwnerOf

func ResourceOwnerOf[T, U metav1.Object](owned U) Func[T]

ResourceOwnerOf will filter returned results to only those that own the given resource.

type Funcs

type Funcs[T metav1.Object] []Func[T]

Funcs is a list of predicates to be AND'd together.

func (Funcs[T]) Evaluate

func (f Funcs[T]) Evaluate(obj T) bool

Evaluate will evaluate all the predicate functions in order, AND'ing together the results.

Jump to

Keyboard shortcuts

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