Fix event recorder interface migration#4896
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Fleet’s GitOps (gitjob) RBAC to align with the post-migration event recorder interface, which now records Kubernetes Events using the events.k8s.io API group and was previously hitting RBAC permission errors.
Changes:
- Adjust gitjob ClusterRole permissions for Events from the core API group (
"") toevents.k8s.io.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
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.
b72b620 to
cf95119
Compare
0xavi0
pushed a commit
to 0xavi0/fleet
that referenced
this pull request
Apr 13, 2026
* 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
pushed a commit
to 0xavi0/fleet
that referenced
this pull request
Apr 13, 2026
* 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
added a commit
that referenced
this pull request
Apr 15, 2026
* Fix event recorder interface migration (#4896) * 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. * Migrate events generation to new interface (#4678) * 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. --------- Co-authored-by: Corentin Néau <tan.neau@suse.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The migration from
controller-runtime'srecord.EventRecordertoevents.EventRecorderseems 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.
Refers to #4895.
Follow-up on #4678.
Additional Information
Checklist
- [ ] I have updated the documentation via a pull request in the fleet-product-docs repository.