rollup

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rollup maintains the all-time FindingRollup statistics and the TTL deletion of completed findings — causally ordered: nothing is deleted before its spend is aggregated into every scope.

Exactly-once accounting: every Investigation/Remediation child contributes one immutable stage delta per scope (ledger key i:<uid> / r:<uid>); every Finding contributes terminal-phase counts to the total and repository scopes (ledger key f:<uid>:<seq>). A revival (retry, approval) reverses those counts at seq+1 — the finding is back in flight, so only spend-like sums (attempts, the monthly trend) stay put — and a later completion counts it again. A per-scope condition marks aggregation on the contributing object, and the matching rollup finalizer is removed only when the object is deleting and its scope condition is true — kubectl delete can never lose un-aggregated spend, and remaining finalizers show exactly which scopes are owed.

Index

Constants

View Source
const DefaultTTL = 336 * time.Hour

DefaultTTL keeps completed findings for 14 days.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reconciler

type Reconciler struct {
	client.Client
	// Namespace the CRs live in.
	Namespace string
	// TTL after completedAt before a finding is deleted; 0 keeps forever.
	TTL time.Duration
	// Now is the clock seam; nil means time.Now.
	Now func() time.Time
	// Log receives diagnostics; nil discards.
	Log *slog.Logger
}

Reconciler aggregates rollups and enforces the finding TTL.

func (*Reconciler) ReconcileFinding

func (r *Reconciler) ReconcileFinding(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

ReconcileFinding aggregates terminal-phase counts, applies revival corrections, releases finalizers on deletion, and enforces the TTL.

func (*Reconciler) ReconcileInvestigation

func (r *Reconciler) ReconcileInvestigation(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

ReconcileInvestigation aggregates one investigation run.

func (*Reconciler) ReconcileRemediation

func (r *Reconciler) ReconcileRemediation(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

ReconcileRemediation aggregates one remediation run.

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the three aggregation controllers.

Jump to

Keyboard shortcuts

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