Skip to content

[v0.15] - Event recorder interface migration#4966

Merged
0xavi0 merged 2 commits into
rancher:release/v0.15from
0xavi0:0.15-4965-fix-events-migration
Apr 15, 2026
Merged

[v0.15] - Event recorder interface migration#4966
0xavi0 merged 2 commits into
rancher:release/v0.15from
0xavi0:0.15-4965-fix-events-migration

Conversation

@0xavi0
Copy link
Copy Markdown
Contributor

@0xavi0 0xavi0 commented Apr 13, 2026

This PR backports 2 PRs that in conjunction migrate the event recorder to use the new interface.
If includes the PR that migrates the recorder and the PR that fixes RBAC issues.

Backport of: #4896
Backport of: #4678
Refers to: #4965
Refers to: #4765

Additional Information

Checklist

- [ ] I have updated the documentation via a pull request in the fleet-product-docs repository.

* Fix event recorder interface migration

The migration from `controller-runtime`'s `record.EventRecorder` to
`events.EventRecorder` seems to have changed the type of events
generated, which led to permissions errors when recording events.

This commit updates Fleet's gitOps RBAC to take that new event type into
account.

* Add regression end-to-end test for event generation

Single-cluster end-to-end tests for GitRepo deployments now validate
that `GotNewCommit` events are generated, which should help catch future
event recording-related issues.
@0xavi0 0xavi0 added this to the v2.14.1 milestone Apr 13, 2026
@0xavi0 0xavi0 added this to Fleet Apr 13, 2026
@0xavi0 0xavi0 changed the title Fix event recorder interface migration (#4896) [v0.15] - Fix event recorder interface migration (#4896) Apr 13, 2026
@0xavi0 0xavi0 marked this pull request as ready for review April 13, 2026 13:51
@0xavi0 0xavi0 requested a review from a team as a code owner April 13, 2026 13:51
@0xavi0 0xavi0 marked this pull request as draft April 14, 2026 08:58
* Migrate events generation to new interface

With `GetEentRecorderFor` being deprecated, controllers now use the new
`GetEventRecorder` method, returning an `events.EventRecorder` instead
of a `record.EventRecorder` interface.

* Fix expectations on source component

When using the new event recorder interface, the recorder does not
populate the source component anymore; instead, the emitter can be
checked through `ReportingController`.
Besides, job creation and deletion actually happen _twice_ when
re-creating a job.

* Use formatting placeholders for errors in events

This should prevent events from containing malformed messages, if
error messages ever contain `%` symbols.
@0xavi0 0xavi0 force-pushed the 0.15-4965-fix-events-migration branch from 37c1646 to 871a718 Compare April 14, 2026 10:16
@0xavi0 0xavi0 requested a review from thardeck April 14, 2026 10:19
@0xavi0 0xavi0 self-assigned this Apr 14, 2026
@0xavi0 0xavi0 changed the title [v0.15] - Fix event recorder interface migration (#4896) [v0.15] - Event recorder interface migration Apr 14, 2026
@0xavi0 0xavi0 marked this pull request as ready for review April 14, 2026 10:55
@thardeck thardeck requested a review from weyfonk April 14, 2026 13:42
@weyfonk weyfonk moved this to 👀 In review in Fleet Apr 15, 2026
@0xavi0 0xavi0 merged commit 2bb4769 into rancher:release/v0.15 Apr 15, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Fleet Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants