Skip to content

Read Events through an uncached APIReader instead of a cluster-wide informer#948

Open
LipatovAlexander wants to merge 1 commit into
k8ssandra:masterfrom
LipatovAlexander:event-uncached-apireader
Open

Read Events through an uncached APIReader instead of a cluster-wide informer#948
LipatovAlexander wants to merge 1 commit into
k8ssandra:masterfrom
LipatovAlexander:event-uncached-apireader

Conversation

@LipatovAlexander

Copy link
Copy Markdown
Contributor

What this PR does:
Reads Events through an uncached mgr.GetAPIReader() instead of the cached client, and drops the corev1.Event field index.

The index existed to serve a single lookup (failureModeDetection reads the events of one pod), but registering it eagerly instantiated a cluster-wide Event informer at startup — Events being the highest-cardinality, highest-churn resource (27k+ objects on a mid-size cluster). In cluster-scoped deployments this informer is a major OOM driver. The field selector involvedObject.name is server-side supported for Events, so the live read is cheap and behavior-identical.

APIReader is threaded through CassandraDatacenterReconciler and ReconciliationContext so future high-cardinality reads can use the same path.

Which issue(s) this PR fixes:
Part of #947 (first of two PRs; the second bounds the rest of the cache)

Checklist

  • Changes manually tested — running in production on five clusters for several days, cluster-scoped, incl. chaos-mesh pod-kill runs
  • Automated Tests added/updated — TestFailureDetection exercises the APIReader path; envtest controller suite passes
  • Documentation added/updated
  • CHANGELOG.md updated
  • CLA Signed

…nformer

The failureModeDetection path listed Events for a single pod through the
cached client. Because controller-runtime instantiates an informer for
every type read through the cache, this one namespaced, field-selected
lookup forced a cluster-wide Event informer — Events being the
highest-cardinality, highest-churn resource in a cluster (27k+ objects
observed on a mid-size production cluster). In cluster-scoped
deployments this informer is a major memory driver and contributes to
OOM kills at startup.

Wire mgr.GetAPIReader() into the reconciler and ReconciliationContext
and use it for the Event lookup: involvedObject.name is a
server-supported field selector for Events, so the live read is cheap
and behavior-identical. Drop the Event field index that existed only to
serve this lookup from the cache (and eagerly created the informer at
startup).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Alexander Lipatov <lipatov@mindbox.cloud>
@LipatovAlexander
LipatovAlexander requested a review from a team as a code owner July 6, 2026 15:06
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

No linked issues found. Please add the corresponding issues in the pull request description.
Use GitHub automation to close the issue when a PR is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant