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

Add Controller::owns_stream #1173

Merged
merged 1 commit into from
Apr 3, 2023
Merged

Add Controller::owns_stream #1173

merged 1 commit into from
Apr 3, 2023

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented Mar 30, 2023

As shortly discussed on discord, this adds owns_stream and owns_stream_with to Controller to allowed customized watch streams for owned objects:

let sts_stream = watcher(Api::<StatefulSet>::all(client.clone()), watcher::Config::default())
    .touched_objects()
    .predicate_filter(predicates::generation);

Controller::new(Api::<CustomResource>::all(client), watcher::Config::default())
    .owns_stream(sts_stream)
    .run(reconcile, error_policy, Arc::new(()))
    .for_each(|_| std::future::ready(()))
    .await;

This patch depends on #911 for docs and is an extension to #1163 .

This can be used to aid stream sharing (#1080).

@Dav1dde Dav1dde marked this pull request as draft March 30, 2023 08:35
@clux clux added the unstable feature that unstable feature gating label Mar 30, 2023
@clux clux added this to the 0.81.0 milestone Mar 30, 2023
@clux clux added the changelog-add changelog added category for prs label Mar 30, 2023
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Merging #1173 (2d8ecec) into main (61f2f32) will increase coverage by 0.15%.
The diff coverage is 68.54%.

❗ Current head 2d8ecec differs from pull request most recent head d59270d. Consider uploading reports for the commit d59270d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1173      +/-   ##
==========================================
+ Coverage   72.43%   72.58%   +0.15%     
==========================================
  Files          65       67       +2     
  Lines        4759     5213     +454     
==========================================
+ Hits         3447     3784     +337     
- Misses       1312     1429     +117     
Impacted Files Coverage Δ
kube-client/src/api/entry.rs 81.18% <0.00%> (-0.82%) ⬇️
kube-client/src/api/util/mod.rs 93.50% <ø> (+0.17%) ⬆️
kube-client/src/discovery/apigroup.rs 89.90% <0.00%> (ø)
kube-client/src/discovery/mod.rs 90.00% <ø> (ø)
kube-client/src/discovery/oneshot.rs 80.00% <ø> (ø)
kube-core/src/admission.rs 61.11% <ø> (ø)
kube-core/src/crd.rs 82.92% <ø> (ø)
kube-core/src/gvk.rs 82.60% <0.00%> (ø)
kube-core/src/schema.rs 89.70% <ø> (ø)
kube-core/src/subresource.rs 76.66% <ø> (ø)
... and 31 more

... and 7 files with indirect coverage changes

Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nits, but looks good.

kube-runtime/src/controller/mod.rs Outdated Show resolved Hide resolved
kube-runtime/src/controller/mod.rs Outdated Show resolved Hide resolved
@Dav1dde Dav1dde force-pushed the owns-stream branch 4 times, most recently from 0410113 to 847d264 Compare March 30, 2023 09:51
@Dav1dde Dav1dde marked this pull request as ready for review March 30, 2023 11:08
@clux clux changed the title implements owns_stream and owns_stream_with for Controller Add Controller::owns_stream Apr 3, 2023
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-add changelog added category for prs unstable feature that unstable feature gating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants