Skip to content

Migrate to new Kubernetes events API#1267

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

Migrate to new Kubernetes events API#1267
adri1197 wants to merge 1 commit intofluxcd:mainfrom
adri1197:event-recorder

Conversation

@adri1197
Copy link
Contributor

@adri1197 adri1197 commented Mar 7, 2026

Migrates to the new Kubernetes events API (events.EventRecorder) to replace the deprecated record.EventRecorder.

  • Updated controllers and EventServer to use events.EventRecorder
  • Replaced manual broadcaster creation with mgr.GetEventRecorder()
  • Updated event format: map details are now logged separately, not included in event messages

Closes fluxcd/flux2#5761

@adri1197 adri1197 marked this pull request as ready for review March 7, 2026 12:20
@adri1197 adri1197 marked this pull request as draft March 7, 2026 12:32
@matheuscscp
Copy link
Member

matheuscscp commented Mar 7, 2026

I think this is a change that needs to be done in fluxcd/pkg first

@adri1197
Copy link
Contributor Author

adri1197 commented Mar 7, 2026

I think this is a change that needs to be done in fluxcd/pkg

Is there a reason notification-controller hasn't been migrated to fluxcd/pkg for Events yet? I see it’s already implemented in helm-controller. I'm happy to include that migration here as I've already begun the work.

@matheuscscp
Copy link
Member

I think this is a change that needs to be done in fluxcd/pkg

Is there a reason notification-controller hasn't been migrated to fluxcd/pkg for Events yet? I see it’s already implemented in helm-controller. I'm happy to include that migration here as I've already begun the work.

Yes, a very specific one: fluxcd/pkg wraps k8s EventRecorder to fan out to notification-controller. But notification-controller can't send events to itself, hence why it doesn't use it. I guess what I meant is: if we're gonna migrate to the new Event API, it has to start with fluxcd/pkg, which is for the other Flux controllers 👌

@adri1197
Copy link
Contributor Author

adri1197 commented Mar 7, 2026

I think this is a change that needs to be done in fluxcd/pkg

Is there a reason notification-controller hasn't been migrated to fluxcd/pkg for Events yet? I see it’s already implemented in helm-controller. I'm happy to include that migration here as I've already begun the work.

Yes, a very specific one: fluxcd/pkg wraps k8s EventRecorder to fan out to notification-controller. But notification-controller can't send events to itself, hence why it doesn't use it. I guess what I meant is: if we're gonna migrate to the new Event API, it has to start with fluxcd/pkg, which is for the other Flux controllers 👌

Got it! Will start with fluxcd/pkg, then. Thanks a lot! 😃

Replace deprecated record.EventRecorder with events.EventRecorder
from k8s.io/client-go/tools/events. Update all controllers, event
server, and tests to use the new API signature.

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.

Implementation new K8s Events API - v1

2 participants