Skip to content

Migrate event recorder to fluxcd/pkg/runtime/events.Recorder#1038

Draft
adri1197 wants to merge 1 commit into
fluxcd:mainfrom
adri1197:event-recorder
Draft

Migrate event recorder to fluxcd/pkg/runtime/events.Recorder#1038
adri1197 wants to merge 1 commit into
fluxcd:mainfrom
adri1197:event-recorder

Conversation

@adri1197

@adri1197 adri1197 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor
  • Replace kuberecorder.EventRecorder with fluxcd/events.Recorder to support structured event metadata including source object and action type.
  • Upgrade event API from event/v1beta1 to event/v1
  • Add action parameter (Reconciled, Failed, Waiting, Applied, Deleted, Progressing) to all event calls for richer event semantics.
  • Pass source reference through reconcile, apply, prune, checkHealth, and finalize methods.
  • Update tests to use events.Recorder.

Closes fluxcd/flux2#5761

@matheuscscp

Copy link
Copy Markdown
Member

Looks like we can do this here in this controller because it does not use AnnotatedEventf right?

@adri1197

adri1197 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Looks like we can do this here in this controller because it does not use AnnotatedEventf right?

Correct — this controller only uses Eventf, so the migration is a direct swap 😃.

Comment thread main.go Outdated

@matheuscscp matheuscscp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@matheuscscp

Copy link
Copy Markdown
Member

@adri1197 CI is failing, PTAL 🙏

@adri1197

adri1197 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@adri1197 CI is failing, PTAL 🙏

Unfortunately, we may have to wait till kubernetes-sigs/controller-runtime#3509 and therefore the upstream k8s MR, in order to merge fluxcd/pkg#1144, which includes github.com/fluxcd/pkg/apis/event/v1 interface.

Replace the local eventLogf helper with the fluxcd/pkg/runtime/events
EventRecorder interface. This removes redundant logging (the recorder
handles it internally) and aligns with the pattern used by other Flux
controllers.

Populate the GitRepository as the related object in all emitted events,
enabling notification-controller to correlate automation events with
their source.

Bump event API from v1beta1 to v1. Replace k8s.io/utils/pointer with
builtin new(). Clean up import grouping in main.go.

Signed-off-by: Adrian Fernandez De La Torre <adri1197@gmail.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.

Implement Kubernetes Event API v1

2 participants