predicate

package
v1.0.134 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterCollectorDeploymentPredicate = ObjectNamePredicate{
	AllowedObjectName: odigosk8sconsts.OdigosClusterCollectorDeploymentName,
}

this predicate will only allow events for the odigos cluster collectors daemon set object. this is useful if you only want to reconcile events for the cluster collectors daemon set object and ignore other daemon set objects.

View Source
var NodeCollectorsDaemonSetPredicate = ObjectNamePredicate{
	AllowedObjectName: odigosk8sconsts.OdigosNodeCollectorDaemonSetName,
}

this predicate will only allow events for the odigos node collectors daemon set object. this is useful if you only want to reconcile events for the node collectors daemon set object and ignore other daemon set objects.

View Source
var OdigosCollectorsGroupClusterPredicate = ObjectNamePredicate{
	AllowedObjectName: odigosk8sconsts.OdigosClusterCollectorCollectorGroupName,
}

use this event filter to reconcile only collectors group events for cluster collectors group objects this is useful if you reconcile only depends on changes from the cluster collectors group and should not react to node collectors group changes example usage: import odigospredicates "github.com/odigos-io/odigos/k8sutils/pkg/predicate" ...

err = ctrl.NewControllerManagedBy(mgr).
	For(&odigosv1.CollectorsGroup{}).
	WithEventFilter(&odigospredicates.OdigosCollectorsGroupClusterPredicate).
	Complete(r)
View Source
var OdigosCollectorsGroupNodePredicate = ObjectNamePredicate{
	AllowedObjectName: odigosk8sconsts.OdigosNodeCollectorCollectorGroupName,
}

use this event filter to reconcile only collectors group events for node collectors group objects this is useful if you reconcile only depends on changes from the node collectors group and should not react to cluster collectors group changes example usage: import odigospredicates "github.com/odigos-io/odigos/k8sutils/pkg/predicate" ...

err = ctrl.NewControllerManagedBy(mgr).
	For(&odigosv1.CollectorsGroup{}).
	WithEventFilter(&odigospredicates.OdigosCollectorsGroupCluster).
	Complete(r)
View Source
var OdigosConfigMapPredicate = ObjectNamePredicate{
	AllowedObjectName: consts.OdigosConfigurationName,
}

This predicate will only allow config map events on the "odigos-config" object, and will filter out events for possible other config maps which the reconciler should not handle. Example usage: import odigospredicates "github.com/odigos-io/odigos/k8sutils/pkg/predicate" ...

err = ctrl.NewControllerManagedBy(mgr).
	For(&corev1.ConfigMap{}).
	WithEventFilter(&odigospredicates.OdigosConfigMapPredicate).
	Complete(r)

Functions

This section is empty.

Types

type AllContainersReadyPredicate added in v1.0.123

type AllContainersReadyPredicate struct{}

AllContainersReadyPredicate is a predicate that checks if all containers in a pod are ready or becoming ready.

For Create events, it returns true if the pod is in Running phase and all containers are ready. For Update events, it returns true if the new pod has all containers ready and started, and the old pod had at least one container not ready or not started. For Delete events, it returns false.

func (*AllContainersReadyPredicate) Create added in v1.0.123

func (*AllContainersReadyPredicate) Delete added in v1.0.123

func (*AllContainersReadyPredicate) Generic added in v1.0.123

func (*AllContainersReadyPredicate) Update added in v1.0.123

type CgBecomesReadyPredicate

type CgBecomesReadyPredicate struct{}

this event filter will only trigger reconciliation when the collectors group was not ready and now it is ready. some controllers in odigos reacts to this specific event, and should not be triggered by other events such as spec updates or status conditions changes. for create events, it will only trigger reconciliation if the collectors group is ready.

func (*CgBecomesReadyPredicate) Create

func (*CgBecomesReadyPredicate) Delete

func (*CgBecomesReadyPredicate) Generic

func (*CgBecomesReadyPredicate) Update

type ConfigMapDataChangedPredicate

type ConfigMapDataChangedPredicate struct{}

this event filter will only trigger reconciliation when the configmap data was changed. the reconciled type must be corev1.ConfigMap note: this preidcate currently only check the Data field of the ConfigMap (without BinaryData)

func (ConfigMapDataChangedPredicate) Create

func (ConfigMapDataChangedPredicate) Delete

func (ConfigMapDataChangedPredicate) Generic

func (ConfigMapDataChangedPredicate) Update

type DeletionPredicate added in v1.0.123

type DeletionPredicate struct{}

DeletionPredicate only allows delete events.

func (DeletionPredicate) Create added in v1.0.123

func (DeletionPredicate) Delete added in v1.0.123

func (DeletionPredicate) Generic added in v1.0.123

func (DeletionPredicate) Update added in v1.0.123

type ExistencePredicate

type ExistencePredicate struct{}

existence predicate only allows create and delete events. it is useful when the controller only reacts to the presence of an object (e.g. if it exists or not), and not to it's content or status changes.

Notice these 2 things when using this predicate: 1. The event filter will allow events for each object on startup, as all the objects are "created" in the cache. 2. If you have important task to do on delete events, make sure it is applied if the event is missed and the controller restarts, since the delete event will not be triggered on controller restart as the object is no longer in k8s.

func (ExistencePredicate) Create

func (ExistencePredicate) Delete

func (ExistencePredicate) Generic

func (ExistencePredicate) Update

type ObjectNamePredicate

type ObjectNamePredicate struct {
	AllowedObjectName string
}

func (ObjectNamePredicate) Create

func (ObjectNamePredicate) Delete

func (ObjectNamePredicate) Generic

func (ObjectNamePredicate) Update

type OnlyUpdatesPredicate

type OnlyUpdatesPredicate struct{}

This predicate only allows update events. It is useful if you handle the initial state when the controller starts, and only need to apply changes for example - when monitoring odigos config changes.

func (OnlyUpdatesPredicate) Create

func (OnlyUpdatesPredicate) Delete

func (OnlyUpdatesPredicate) Generic

func (OnlyUpdatesPredicate) Update

Jump to

Keyboard shortcuts

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