Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to aggregate repeated events with the recorder. #1606

Closed
johnthompson-ybor opened this issue Oct 17, 2024 · 4 comments · Fixed by #1655
Closed

A way to aggregate repeated events with the recorder. #1606

johnthompson-ybor opened this issue Oct 17, 2024 · 4 comments · Fixed by #1655
Labels
runtime controller runtime related

Comments

@johnthompson-ybor
Copy link

Would you like to work on this feature?

None

What problem are you trying to solve?

As far as I can tell, there's only a way to create new events which all get displayed separately -- I need a way to aggregate events that happen more than once within a certain amount of time. The go recorder does this:

https://pkg.go.dev/k8s.io/client-go/tools/record#EventAggregator

Describe the solution you'd like

Some way to update the count of an existing event or otherwise aggregate events.

Describe alternatives you've considered

using the events api directly instead of the recorder.

Documentation, Adoption, Migration Strategy

No response

Target crate for feature

kube-runtime

@clux
Copy link
Member

clux commented Oct 17, 2024

That seems to be a different way of doing something we already do in the Controller; debouncing repeat events to the same object.

Have a look at controller docs for debouncing, maybe this is sufficient for you?

@johnthompson-ybor
Copy link
Author

johnthompson-ybor commented Oct 17, 2024

That's for events you're subscribed to -- i'm talking about publishing events -- see this from client go:

https://github.com/kubernetes/kubernetes/blob/9568a2ac145cf9be930e3da835f86c1e61f7f7c1/staging/src/k8s.io/client-go/tools/record/events_cache.go

https://dev.to/shuheiktgw/kubernetes-event-aggregation-and-spam-filtering-in-client-go-25mn

A perhaps more informative blog post.

@johnthompson-ybor
Copy link
Author

It's quite possible I'm misunderstanding how this works, but the main issue is if i'm publishing the exact same event multiple times with the kube-rs recorder, it doesn't get aggregated in kubernetes, it shows up as distinct events.

@clux
Copy link
Member

clux commented Oct 17, 2024

Oh, I see, apologies. Indeed, we do not have any way of doing this. Thanks for reporting this.

This does sound like nice functionality/module to have, but would need some time to sit down with this to see how it could be adopted in a sane rust-idiomatic way. Experiments/comments/direction advice here are definitely welcome.

@clux clux added the runtime controller runtime related label Oct 17, 2024
@clux clux linked a pull request Dec 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runtime controller runtime related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@clux @johnthompson-ybor and others