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

Upgrade kube to 0.98 and migrate event Recorder #116

Merged
merged 7 commits into from
Dec 23, 2024
Merged

Conversation

clux
Copy link
Member

@clux clux commented Dec 9, 2024

for kube-rs/kube#1655

Migration

It is recommended to now create the event Recorder globally (and not inside the reconciler) because it caches recent events to not over-publish.

This can generally be done by stuffing it inside the Context you pass to the Controller and then give it an extra object reference (which you previously used to construct the Recorder) when publishing events.

(In our case that's made Context creation async, but that's because we use an async mutex around it.)

Showcasing

using cargo run (and installing the crd)

we can get repeat events using k apply -f yaml/instance-samuel.yaml and then k edit doc samuel to toggle hide on and off.

and it aggregates it correctly:

Events:
  Type    Reason         Age   From            Message
  ----    ------         ----  ----            -------
 Normal  HideRequested  56s (x2 over 75s)  doc-controller  Hiding `samuel`

Note the (x2 over 75s) part which is kubectl displaying EventSeries.

@clux clux changed the title test out new event recorder interface Upgrade kube to 0.98 and migrate event Recorder Dec 23, 2024
Signed-off-by: clux <[email protected]>
@kube-rs kube-rs deleted a comment from github-actions bot Dec 23, 2024
clux added 2 commits December 23, 2024 13:15
Signed-off-by: clux <[email protected]>
Signed-off-by: clux <[email protected]>
@clux clux marked this pull request as ready for review December 23, 2024 13:22
@clux clux merged commit ac0b94a into main Dec 23, 2024
8 checks passed
@clux clux deleted the test-new-recorder branch December 23, 2024 13:23
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.

1 participant