Documentation
¶
Index ¶
Constants ¶
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 ¶
func New(client typedeventsv1.EventsV1Interface, log logr.Logger) *Recorder
New builds a Recorder that writes through client.
func (*Recorder) ConditionChanged ¶
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 ¶
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.