predicate

package
v1.47.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultClass is used as resource class if no class is specified on the command line
	DefaultClass = "resources"

	// FinalizerName is the finalizer base name that is injected into ManagedResources.
	// The concrete finalizer is finally containing this base name and the resource class.
	FinalizerName = "resources.gardener.cloud/gardener-resource-manager"
)

Variables

This section is empty.

Functions

func ClassChangedPredicate

func ClassChangedPredicate() predicate.Predicate

ClassChangedPredicate is a predicate for changes in `.spec.class`.

func ConditionStatusChanged

func ConditionStatusChanged(conditionType gardencorev1beta1.ConditionType, changeFn ConditionChangeFn) predicate.Predicate

ConditionStatusChanged is a predicate that detects changes to the status of a Condition with a given type.

func GotMarkedAsIgnored added in v1.47.0

func GotMarkedAsIgnored() predicate.Predicate

GotMarkedAsIgnored returns a predicate that detects if resources.gardener.cloud/ignore=true annotation was added during an update.

func HasFinalizer

func HasFinalizer(finalizer string) predicate.Predicate

HasFinalizer returns a predicate that detects if the object has the given finalizer This is used to not requeue all secrets in the cluster (which might be quite a lot), but only requeue secrets from create/update events with the controller's finalizer. This is to ensure, that we properly remove the finalizer in case we missed an important update event for a ManagedResource.

func HasOperationAnnotation added in v1.39.0

func HasOperationAnnotation() predicate.Predicate

HasOperationAnnotation is a predicate for the operation annotation.

func NoLongerIgnored added in v1.43.0

func NoLongerIgnored() predicate.Predicate

NoLongerIgnored returns a predicate that detects if resources.gardener.cloud/ignore=true annotation was removed during an update.

func NotIgnored added in v1.43.0

func NotIgnored() predicate.Predicate

NotIgnored returns a predicate that detects if the object has the resources.gardener.cloud/ignore=true annotation.

Types

type ClassFilter

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

ClassFilter keeps the resource class for the actual controller instance and is used as Filter predicate for events finally passed to the controller

func NewClassFilter

func NewClassFilter(class string) *ClassFilter

NewClassFilter returns a new `ClassFilter` instance.

func (*ClassFilter) Active

func (f *ClassFilter) Active(o runtime.Object) (action bool, responsible bool)

Active checks whether a dedicated object must be handled by the actual controller instance. This is split into two conditions. An object must be handled if it has already been handled, indicated by the actual finalizer, or if the actual controller is responsible for the object.

func (*ClassFilter) Create

func (f *ClassFilter) Create(e event.CreateEvent) bool

Create implements `predicate.Predicate`.

func (*ClassFilter) Delete

func (f *ClassFilter) Delete(e event.DeleteEvent) bool

Delete implements `predicate.Predicate`.

func (*ClassFilter) FinalizerName

func (f *ClassFilter) FinalizerName() string

FinalizerName determines the finalizer name to be used for the actual resource class

func (*ClassFilter) Generic

func (f *ClassFilter) Generic(e event.GenericEvent) bool

Generic implements `predicate.Predicate`.

func (*ClassFilter) ResourceClass

func (f *ClassFilter) ResourceClass() string

ResourceClass returns the actually configured resource class

func (*ClassFilter) Responsible

func (f *ClassFilter) Responsible(o runtime.Object) bool

Responsible checks whether an object should be managed by the actual controller instance

func (*ClassFilter) Update

func (f *ClassFilter) Update(e event.UpdateEvent) bool

Update implements `predicate.Predicate`.

type ConditionChangeFn

type ConditionChangeFn func(con1, con2 *gardencorev1beta1.Condition) bool

ConditionChangeFn is a type for comparing two conditions.

var ConditionChangedToUnhealthy ConditionChangeFn = func(con1, con2 *gardencorev1beta1.Condition) bool {
	return (con1 == nil || con1.Status == gardencorev1beta1.ConditionTrue) &&
		(con2 != nil && con2.Status == gardencorev1beta1.ConditionFalse)
}

ConditionChangedToUnhealthy compares the given conditions and returns `true` if the `Status` has changed to an unhealthy state.

var DefaultConditionChange ConditionChangeFn = func(con1, con2 *gardencorev1beta1.Condition) bool {
	if con1 == nil {

		return con2 != nil
	}

	if con2 == nil {
		return true
	}

	return con1.Status != con2.Status
}

DefaultConditionChange compares the given conditions and returns `true` if the `Status` has changed.

Jump to

Keyboard shortcuts

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