Skip to content

[WIP] [V2] Emit action events as Kubernetes Events - #8116

Draft
jeffoodchain wants to merge 4 commits into
flyteorg:mainfrom
jeffoodchain:feat/cloud_events
Draft

jeffoodchain wants to merge 4 commits into
flyteorg:mainfrom
jeffoodchain:feat/cloud_events

Conversation

@jeffoodchain

Copy link
Copy Markdown

Tracking issue

Closes #7829
Related to #7903

Why are the changes needed?

Flyte 1 pushed each execution event to a message broker. Flyte 2 has no such path, so
systems outside Flyte (lineage, alerting, cost accounting) cannot react to action events.

The design in #7903 solves this without a broker client in Flyte. The executor emits each
action event as a k8s Event on the TaskAction. An operator deploys a third-party
exporter (for example resmoio/kubernetes-event-exporter) and routes the events to Kafka, Loki, or a webhook.

What changes were proposed in this pull request?

Design Doc: #7903

This PR is still work in progress, and will be updated frequently.

Done:

  • truncateUTF8: cut a note to the 1024-byte apiserver limit and keep valid UTF-8. (in doc, it is truncateRunes)
  • Export actionsk8s.IsTerminalPhase so the executor can reuse it.
  • EventLevel (off, terminal, info, debug) and eventLevelOf, which classifies an action event. A system retry is a QUEUED event in the reserved version range.
  • buildActionEventK8s: build an events.k8s.io/v1 Event from an ActionEvent.

TODOs:

  • Set ReportingInstance on the reconciler.
  • Limit the size of flyte.org/info. The apiserver caps all annotations of one object at 256 KiB.
  • Add parent-action-name and task-type annotations. Remove the unused launch-plan and principal keys (TaskActionSpec has neither).
  • Decide the run annotation key: flyte.org/run-name or the existing label key flyte.org/run.
  • Unit tests for the emit path (fake client and fake recorder).
  • Verify on a devbox: the apiserver accepts the event, and the exporter can match and template it.
  • e2e tests for different consumer
  • Document the exporter setup and the delivery guarantees: events live for 1h, delivery is at-least-once, consumers dedupe on (action-name, attempt, phase, version).

How was this patch tested?

Unit tests in executor/pkg/controller/k8s_event_test.go:

  • TestTruncateUTF8: ASCII cases, a cut inside a multi-byte rune, invalid bytes.
  • TestBuildActionEventK8s: fields the apiserver validates, error annotations with and
    without ErrorInfo, and flyte.org/info decodes back to the original event.
  • TestEventLevelOf, TestEventType, TestEventReason, TestHumanSummary.

Not tested yet: no apiserver has accepted one of these events. That is the devbox item above.

Labels

  • added

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

#7903

Signed-off-by: Jeff Chung <sh1001309@gmail.com>
Signed-off-by: Jeff Chung <sh1001309@gmail.com>
Signed-off-by: Jeff Chung <sh1001309@gmail.com>
Signed-off-by: Jeff Chung <sh1001309@gmail.com>
@github-actions github-actions Bot added the flyte2 label Oct 3, 2026

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v2] Restore CloudEvents egress for run/action lifecycle (Kafka / external sinks)

1 participant