utils

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReconcileWait string = "RECONCILE_WAIT"
)

Variables

This section is empty.

Functions

func AddHashToObject

func AddHashToObject(obj client.Object, name string) error

func LookupReconcileTime added in v0.0.3

func LookupReconcileTime(log logr.Logger) time.Duration

Types

type CommonPredicates

type CommonPredicates struct {
	ControllerName   string
	IgnoreAnnotation string
	Log              logr.Logger
}

CommonPredicates struct holds the fields to initalise common predicate methods.

func (*CommonPredicates) IgnoreNamespacePredicate

func (c *CommonPredicates) IgnoreNamespacePredicate(obj client.Object) bool

IgnoreNamespacePredicate is a function that, when initialized within the create and update predicates, filters out the namespaces that should NOT be reconciled in the DENY_LIST. This function is particularly useful in scenarios where the controller watches all the namespaces but wants to exclude certain ones, such as kube-system and default. By using the DENY_LIST feature, the controller can ensure that the excluded namespaces are not processed during the reconciliation process, thus reducing unnecessary overhead.

Controllers can watch a single namespace, multiple namespaces, or all namespaces. When the IgnoreNamespacePredicate function is used, it allows the controller to further refine which namespaces are processed. This function should be called within the create and update predicates to ensure that the namespaces are properly filtered before reconciliation takes place.

func (*CommonPredicates) IgnoreObjectPredicate

func (c *CommonPredicates) IgnoreObjectPredicate(obj client.Object) bool

IgnoreIgnoredObjectPredicate is a function that, when initialized within the create or update predicate, filters out the namespaces that have an ignore annotation present. This function is particularly useful when a controller is reconciling multiple, all, or a single custom resource. In such scenarios, the controller may need to pause reconciliation on a specific custom resource. By using this function, the controller can filter out the namespaces with the ignore annotation.

This function should be called within the create or update predicate to ensure that the namespaces with the ignore annotation are properly filtered before reconciliation takes place.

func (*CommonPredicates) IgnoreUpdate

func (c *CommonPredicates) IgnoreUpdate(e event.UpdateEvent) bool

IgnoreUpdate to ignore the Update events when nothing has changed in the resource version

type ConfigMapHash

type ConfigMapHash struct {
	Object client.Object
}

type HashHolder

type HashHolder struct {
	Name      string
	HashVaule string
}

func MakeConfigMapHash

func MakeConfigMapHash(configHash []ConfigMapHash) ([]HashHolder, error)

type Predicates

type Predicates interface {
	IgnoreNamespacePredicate(obj client.Object) bool
	IgnoreObjectPredicate(obj client.Object) bool
	IgnoreUpdate(e event.UpdateEvent) bool
}

func NewCommonPredicates

func NewCommonPredicates(
	controllerName, ignoreAnnotation string,
	log logr.Logger) Predicates

NewCommonPredicates is contstructor for CommonPredicates

Jump to

Keyboard shortcuts

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