predicate

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 resourcesv1alpha1.ConditionType, changeFn ConditionChangeFn) predicate.Predicate

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

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.

Types

type ConditionChangeFn

type ConditionChangeFn func(con1, con2 *resourcesv1alpha1.ManagedResourceCondition) bool

ConditionChangeFn is a type for comparing two conditions.

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

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

var DefaultConditionChange ConditionChangeFn = func(con1, con2 *resourcesv1alpha1.ManagedResourceCondition) 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