reportevents

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ReasonPolicyViolation    = "PolicyViolation"
	ReasonPolicyWouldViolate = "PolicyWouldViolate"
	ReasonPolicyError        = "PolicyError"
)

Reasons this package emits.

Variables

This section is empty.

Functions

This section is empty.

Types

type Recorder

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

Recorder turns reporter findings and RuntimePolicy status transitions into Kubernetes Events.

It writes eventsv1.Event objects directly through the typed client instead of through events.EventRecorder. That recorder's correlator keys solely on (type, action, reason, reportingController, reportingInstance, regarding, related) — it never looks at the note — so two distinct causes that share those fields (different targets of the same policy and pod, or a changed failure reason under an unchanged condition type) collapse into one Event series and silently lose every message but the first. Naming each Event deterministically from the finding's fingerprint, or from the policy UID and condition type for a policy error, gives every distinct cause its own object, while a genuine repeat of the identical cause still coalesces: the second write patches the existing object's series and note instead of creating a new one.

func New

New builds a Recorder that writes through client.

func (*Recorder) ConditionChanged

func (r *Recorder) ConditionChanged(policyUID, policyName string, cond metav1.Condition)

ConditionChanged satisfies the StatusWriter's onConditionChanged callback. It emits only for a False transition of Applied or TargetsValid, and only once the policy's name is known: a RuntimePolicy is cluster-scoped, so nothing else can address it as regarding.

func (*Recorder) FindingFlushed

func (r *Recorder) FindingFlushed(f reporter.Finding, count int)

FindingFlushed satisfies reporter.Options.FlushSink. The fingerprint is captured before redaction, matching the identity the reporter itself dedupes findings by; f then passes through reporter.Redact/Sanitize before any of it reaches the Event note.

Jump to

Keyboard shortcuts

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