events

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const EventTypeCreate = "create"
View Source
const EventTypeDelete = "delete"
View Source
const EventTypeUpdate = "update"

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event[T any] struct {
	Type   string
	Obj    T
	OldObj T
}

type NamespaceEventHandler

type NamespaceEventHandler interface {
	// NamespaceEvent delivers create and update; on delete, nsLabels is nil.
	NamespaceEvent(name string, nsLabels map[string]string, evType string)
}

NamespaceEventHandler receives namespace labels from the pod watcher's namespace informer. It exists for handlers that match a policy's namespaceSelector but hold no pod state, so they cannot read the labels off a pod event.

type PodEventHandler

type PodEventHandler interface {
	// PodEvent delivers create and update. Deletes arrive via PodDeleted.
	//
	// nsLabels is the label set of the pod's namespace, read by the watcher so
	// a policy's namespaceSelector can be matched without every handler
	// holding its own namespace cache.
	PodEvent(pod corev1.Pod, nsLabels map[string]string, cgInfos []*containers.ContainerCgroupInfo, podEventType string) error
	// PodDeleted announces that the pod with the given UID is gone. Only the
	// UID is delivered: the object itself may no longer exist anywhere, and
	// handing out a synthesized pod would invite reads of fields that are
	// silently empty on the delete path only.
	PodDeleted(uid string) error
}

PodEventHandler receives the pod stream from the pod watcher. Handlers that only care about policies implement RuntimePolicyEventHandler instead.

type RuntimePolicyEventHandler

type RuntimePolicyEventHandler interface {
	RuntimePolicyEvent(rp *compiler.EvaluationResult, rpEventType string) error
}

RuntimePolicyEventHandler receives the RuntimePolicy stream from the policy informer.

Jump to

Keyboard shortcuts

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