-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Add Controller::reconcile_on #1163
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1163 +/- ##
==========================================
- Coverage 73.49% 72.52% -0.97%
==========================================
Files 68 67 -1
Lines 5349 5216 -133
==========================================
- Hits 3931 3783 -148
- Misses 1418 1433 +15
|
Hey there. Thanks a lot for this. This looks like a high potential building block going forward! There are actually two potential use cases for the signature you've proposed:
it might be more natural to sell this in the docs as a trigger helper initially, because i feel that maybe this is too low-level to recommend as the main interface for re-using streams. e.g. maybe we should have something like Anyway, I am at least kind of keen to try this out to verify. It looks like it can at the very least bypass some of the stream recreation problems. Probably would reference this PR in a controller-rs PR to try it out a bit first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick comment, haven't tested out anything, and currently this isn't tested
I added a no_run doc test example. Should I add some unit tests also ?
I agree, the good thing about it being low level, and not related to watches, is that it can used for others use cases. For example you can watch an external database and trigger the reconcile process on arbitrary resources. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks sensible to me, although doc tests are failing. left minor notes on it.
Should I add some unit tests also ?
it's probably hard to find a good setup for this in Controller
. The doc test is probably ok. Although i am open to suggestions.
0ecfcd3
to
581865c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor doc nits plus help for making tests pass.
you can probably run cargo test -p kube-runtime --all-features --doc
locally also
Sorry about that. Tests are working now and I applied your comments |
dd50e38
to
511b78b
Compare
Ah, thanks for this. This looks better. Although you got screwed by being behind the PR #1162. Think this will pass after swapping |
Also, do you mind adding an unstable flag for this initially?
If it's good after a few versions we'll remove this. |
Maybe |
I think for a main stream sharing interface, yes, we would rather want an input of raw I think going forward we should explore (in other PRs) functionality like:
That can take a stream of |
511b78b
to
d4a43b3
Compare
I rebased and added a feature flag. Do I need to change something else ? |
Signed-off-by: Corentin Regal <[email protected]>
Signed-off-by: Corentin Regal <[email protected]>
Signed-off-by: Corentin Regal <[email protected]>
Signed-off-by: Corentin Regal <[email protected]>
Signed-off-by: Corentin Regal <[email protected]>
d4a43b3
to
e2f86d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you very much!
Allow to feed the controller with a stream of
ObjectRef<K>
to reconcile.Motivation
When creating a controller which watches some pods I wanted to be able to cache them with a reflector, and use the cache later in the reconcile function.
I does nos seems to be possible right now. Some PRs and issues related : #824 #1080.
This solution allow to do it with only one watch, which ensure that resources in the store are up to date when queried within the reconcile function.
Solution
Add a function
Controller::reconcile_on
which take a stream ofObjectRef<K>
as parameter.If the design is accepted I'll add documentation and tests