Skip to content

Add events-to-logs feature leveraging the k8s_events receiver - #215

Closed
csatib02 with Copilot wants to merge 5 commits into
mainfrom
copilot/add-events-to-logs-feature
Closed

Add events-to-logs feature leveraging the k8s_events receiver#215
csatib02 with Copilot wants to merge 5 commits into
mainfrom
copilot/add-events-to-logs-feature

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Adds an events-to-logs feature (#199) that collects Kubernetes events as log records using the OpenTelemetry k8s_events receiver and routes them through a tenant's existing subscription/output pipelines.

API

  • New eventsToLogs boolean on TenantSpec. Events are scoped to the namespaces resolved by logSourceNamespaceSelectors, or all namespaces when selectFromAllNamespaces: true, preserving tenant isolation.
  • CRD manifests and Helm chart CRDs regenerated via make generate.
apiVersion: telemetry.kube-logging.dev/v1alpha1
kind: Tenant
spec:
  eventsToLogs: true
  logSourceNamespaceSelectors:
    - matchLabels:
        nsSelector: example-tenant

Config generation

  • New GenerateKubernetesEventsReceiver emits a k8s_events/<tenant> receiver with namespaces set to the tenant's log source namespaces (omitted when selecting from all namespaces).
  • generateReceivers adds the receiver per tenant when enabled; GenerateRootPipeline now takes a receiver list so the tenant root log pipeline includes k8s_events/<tenant> alongside filelog/<tenant>.

RBAC

  • Collector ClusterRole grants get/watch/list on core events so the receiver can watch them.

Tests

  • Unit tests for the receiver generator (namespaced / all-namespaces / empty cases).
  • Complex config fixture extended with an eventsToLogs-enabled tenant, covering receiver and pipeline wiring end-to-end.

Caveat

Since the collector runs as a DaemonSet, each collector pod receives the events, so they are duplicated once per node (same behavior as running multiple replicas of the upstream receiver). This is documented on the API field.

Copilot AI linked an issue Jul 17, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add events-to-logs feature leveraging k8s_events receiver Add events-to-logs feature leveraging the k8s_events receiver Jul 17, 2026
Copilot AI requested a review from csatib02 July 17, 2026 17:06
@csatib02
csatib02 marked this pull request as ready for review July 17, 2026 17:07
@csatib02
csatib02 requested a review from OverOrion July 17, 2026 17:08
Comment thread pkg/resources/otel_conf_gen/pipeline/components/receiver/k8s_events_receiver.go Outdated
Comment thread api/telemetry/v1alpha1/tenant_types.go Outdated
Comment thread pkg/resources/manager/collector_manager.go
csatib02 added 3 commits July 17, 2026 20:26
- Move eventsToLogs from Tenant to Collector CRD as a struct exposing
  kube_api_qps, kube_api_burst and dedup_interval; wire storage into the
  k8s_events receiver like the filelog receiver
- Grant the collector (and the operator, for RBAC escalation) get/list/watch
  on core events; propagate to generated ClusterRole, config/rbac and helm chart
- Fix copyright headers to 2026
- Document that events are read cluster-wide regardless of tenant scoping

Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
@csatib02

Copy link
Copy Markdown
Member

Folded into #216 as the 'feature' commit.

@csatib02 csatib02 closed this Jul 19, 2026
csatib02 added a commit that referenced this pull request Aug 7, 2026
Squash-merges the events-to-logs feature (PR #215): adds the k8s_events
receiver wiring, EventsToLogs API field, CRD/RBAC, and docs. Adapted to the
snake_case component names introduced in the preceding commit.

Signed-off-by: Bence Csati <bence.csati@axoflow.com>
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.

Add events-to-logs Feature

2 participants