refactor: update events API to use GetEventRecorder method for controller-runtime event code#346
Open
refactor: update events API to use GetEventRecorder method for controller-runtime event code#346
Conversation
- Updated all event recorder types from record.EventRecorder to events.EventRecorder - Replaced GetEventRecorderFor with GetEventRecorder - Updated event recording calls to use new API signature - Updated RBAC to use events.k8s.io apiGroup instead of core apiGroup Co-authored-by: jmclong <44989821+jmclong@users.noreply.github.com>
Contributor
|
Keep our packages as events and name the kubernetes events packages kevents. Also, preserve the old rbac do we will be able to write the old events during upgrade. |
- Renamed k8s.io/client-go/tools/events import to kevents
- Kept internal events package as events (no alias)
- Added both core ("") and events.k8s.io RBAC permissions for upgrade compatibility
Co-authored-by: jmclong <44989821+jmclong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate to GetEventRecorderFor for controller-runtime v0.23.0
Migrate to GetEventRecorder API for controller-runtime v0.23.0+
Jan 28, 2026
Updated test files to use kevents.FakeRecorder instead of the deprecated record.FakeRecorder: - internal/gc/lvm_orphan_cleanup_test.go - internal/gc/failover_pv_cleanup_test.go - internal/manager/pvcleanup/suite_test.go This fixes the build error where record.FakeRecorder doesn't implement the new kevents.EventRecorder interface. Co-authored-by: jmclong <44989821+jmclong@users.noreply.github.com>
Copilot
AI
changed the title
Migrate to GetEventRecorder API for controller-runtime v0.23.0+
Fix test files using deprecated record.FakeRecorder after event API migration
Jan 28, 2026
rnhan
approved these changes
Mar 5, 2026
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.
Build failure: test files still used
record.FakeRecorderwhich doesn't implement the newkevents.EventRecorderinterface required after migrating to controller-runtime v0.23.0's event API.Changes
Updated 3 test files:
internal/gc/lvm_orphan_cleanup_test.go(2 instances)internal/gc/failover_pv_cleanup_test.go(1 instance)internal/manager/pvcleanup/suite_test.go(2 instances)Migration pattern:
The new
kevents.EventRecorderinterface has a differentEventfsignature:Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.