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

reflector: add helper function to the Store #1111

Merged
merged 2 commits into from
Dec 28, 2022

Conversation

eliad-wiz
Copy link
Contributor

Signed-off-by: Eliad Peller eliad.peller@wiz.io

Motivation

When using the reflector as local cache it's a bit expensive to clone the whole store when looking for a specific resource (assuming you don't know the ObjectRef in advance)

Solution

add some helper functions to the store struct to help finding a specific resource, and determining the current store size.

Signed-off-by: Eliad Peller <eliad.peller@wiz.io>
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.

I like this a lot, thanks for doing this! Have wanted extensions myself, but we were using dashmap at the time when we thought about this, and then it was hard (and cloning somewhere outside periodically was an OK tradeoff at the time).

Now it makes a lot more sense. So plus one. Minor comment in tests.

@codecov-commenter
Copy link

codecov-commenter commented Dec 28, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@3a3f77f). Click here to learn what that means.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1111   +/-   ##
=======================================
  Coverage        ?   72.60%           
=======================================
  Files           ?       65           
  Lines           ?     4870           
  Branches        ?        0           
=======================================
  Hits            ?     3536           
  Misses          ?     1334           
  Partials        ?        0           
Impacted Files Coverage Δ
kube-runtime/src/reflector/store.rs 96.47% <100.00%> (ø)

@clux clux added runtime controller runtime related changelog-add changelog added category for prs labels Dec 28, 2022
@clux clux added this to the 0.78.0 milestone Dec 28, 2022
Signed-off-by: Eliad Peller <eliad.peller@wiz.io>
@eliad-wiz
Copy link
Contributor Author

thanks for the quick review!

@clux clux merged commit 9846138 into kube-rs:main Dec 28, 2022
@clux clux changed the title reflector: add some helper function to the store reflector: add helper function to the Store Jan 6, 2023
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 runtime controller runtime related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants