Skip to content

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

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

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

Migrate from the local eventLogf helper to fluxcd/pkg/runtime/events.Recorder, aligning with other Flux controllers.

  • Embed events.Recorder and wire it in main.go via WithManager (core/v1 Kubernetes Event backend); drop the redundant local logging.
  • Emit the GitRepository as the related object so notification-controller can correlate events with their source.
  • Upgrade the event payload from event/v1beta1 to event/v1.
  • Add an Action type for the reconcile stages (Reconcile, ListPolicies, ConfigureSource, ApplyPolicies, CommitAndPush) and attribute each failure to its stage.
  • Extend the notify test to assert both the event/v1 webhook payload and the core/v1 Kubernetes Event for every outcome.

Part-of: 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.

@adri1197
adri1197 marked this pull request as ready for review October 2, 2026 11:11
@adri1197
adri1197 requested a review from matheuscscp October 2, 2026 11:11
@stefanprodan

stefanprodan commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

@adri1197 please go over all the PRs and update their description, we are not moving away from core/v1 and the PR should say it.

Comment thread internal/controller/imageupdateautomation_controller.go
Migrate to fluxcd/pkg/runtime/events.Recorder and emit the GitRepository
as the related object so notification-controller can correlate events with
their source. Add an Action type and attribute each failure to its reconcile
stage. Upgrade the event payload from event/v1beta1 to event/v1.

Signed-off-by: Adrian Fernandez De La Torre <adri1197@gmail.com>

@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! 🚀

Thanks @adri1197!

@stefanprodan main attention point is probably actionForReason(), which looks reasonable to me.

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.

3 participants