Documentation
¶
Overview ¶
Package context is the context-controller's engine: it reacts to freshly opened Findings, runs the enhancer chain (CMDB ownership, infrastructure context — pkg/enhance plugins), records each contribution as an enrichment on the Finding's status, and advances Opened → Enhanced. It holds no tracking-system credential — projecting enrichments as issue comments is integration-controller work.
Enhancement is best-effort by design: a failing enhancer is logged and skipped, and the transition happens regardless — enrichment must never block the pipeline.
Index ¶
- func AWSTagsConfigSource(r client.Reader, namespace string) enhancers.AWSConfigSource
- func AssetConfigSource(r client.Reader, namespace string) enhancers.ConfigSource
- func AzureTagsConfigSource(r client.Reader, namespace string) enhancers.AzureConfigSource
- func GenericEnhancerConfigSource(r client.Reader, secrets client.Reader, namespace string, log *slog.Logger) enhancers.GenericConfigSource
- type FindingReconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AWSTagsConfigSource ¶ added in v0.9.0
func AWSTagsConfigSource(r client.Reader, namespace string) enhancers.AWSConfigSource
AWSTagsConfigSource reads the resourceTags capability off the namespace's aws Integration, under the same rules as AssetConfigSource: per enhancement through the informer cache, nil when unconfigured, an error on ambiguity.
func AssetConfigSource ¶ added in v0.9.0
func AssetConfigSource(r client.Reader, namespace string) enhancers.ConfigSource
AssetConfigSource reads the cloudAssetInventory capability off the namespace's google-cloud Integration, through the manager's informer cache. Read per enhancement rather than captured at startup, so an operator changing the Integration needs no controller restart — the same rule the receiver applies to webhook secrets.
No capability configured is a nil config (the enhancer stands aside); two Integrations claiming it is an error (the singleton rule), which fails the enhancement closed into a hold rather than picking one arbitrarily.
func AzureTagsConfigSource ¶ added in v0.9.0
func AzureTagsConfigSource(r client.Reader, namespace string) enhancers.AzureConfigSource
AzureTagsConfigSource reads the resourceTags capability off the namespace's azure Integration, under the same rules as AssetConfigSource: per enhancement through the informer cache, nil when unconfigured, an error on ambiguity.
func GenericEnhancerConfigSource ¶ added in v0.9.1
func GenericEnhancerConfigSource( r client.Reader, secrets client.Reader, namespace string, log *slog.Logger, ) enhancers.GenericConfigSource
GenericEnhancerConfigSource reads every enabled generic enhancer endpoint in the namespace: the Integration list through the informer cache, each signing secret through the API reader (Secrets are never cached, the cluster-wide rule). Generic is the one capability exempt from the singleton rule, so this Lists rather than Selects — every enabled integration enhances, each under its own name.
A Secret that cannot be read does not drop its integration from the list: the config is returned secret-less, the call fails for that endpoint alone, and the per-endpoint error carries the integration's name — one broken Secret must not silently skip an enhancer, nor take down the rest.
Types ¶
type FindingReconciler ¶
type FindingReconciler struct {
client.Client
// Enhancers run in order; each contributes at most one enrichment.
Enhancers []enhance.Enhancer
// RetryAfter paces retries of a cloud finding's repository lookup; zero
// means defaultRetryAfter.
RetryAfter time.Duration
// Now is the clock seam; nil means time.Now.
Now func() time.Time
// Log receives diagnostics; nil discards.
Log *slog.Logger
}
FindingReconciler runs the enhancer chain over freshly opened Findings — the CRD-native context-controller. It writes Finding status (enrichments, owners, the ContextEnhanced condition, and the Opened→Enhanced edge) and exactly one spec field: spec.repository, set once for a cloud finding that arrived without one. It holds no tracking-system credential — comments are integration-controller projection work — though an enhancer may hold a read-only credential for whatever it looks findings up in.
func (*FindingReconciler) SetupWithManager ¶
func (r *FindingReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager wires the reconciler.