kube-rs / controller-rs

A kubernetes reference controller with actix-web
Apache License 2.0
282 stars 27 forks source link

Showcase predicate filters with timestamp in status #50

Open clux opened 1 year ago

clux commented 1 year ago

This was impossible before kube 0.81.

Having a random timestamp in a status field would cause the controller to spin constantly as it kept triggering itself. Now with predicates from https://github.com/kube-rs/kube/pull/911 it is possible to avoid this and have timestamps (say) in status objects.

Probably not going to merge this as these are unstable interfaces, just showcasing it here atm.

azat commented 2 months ago

Hi @clux. Any plans on making this API stable? (maybe I should write to the issue instead...)

clux commented 1 month ago

Hey, that would be a kube issue. I think this is probably close. But want to have a think w.r.t. more complicated filters, because while they are useful right now, there are some more complicated filters we could do that could follow the same pattern. I don't think that should need to change the existing predicates though.

I'll open an issue in kube over the weekend probably, otherwise feel free to raise it.

EDIT: thought about it, seems completely reasonable. PR in https://github.com/kube-rs/kube/pull/1578

clux commented 1 month ago

Updated this PR against current. Predicates are stabilised in 0.96, but the for_streams interface for Controller is not, hopefully we can settle this down if we get good confidence in the shared streams edge cases.