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

Label selector support #1539

Merged
merged 7 commits into from
Jul 20, 2024
Merged

Conversation

Danil-Grigorev
Copy link
Member

@Danil-Grigorev Danil-Grigorev commented Jul 17, 2024

Motivation

Allow to perform client side resource selection logic based on label selectors, compatible with upstream LabelSelector resource.

Solution

Continued implementation for #1482
Outstanding tasks:

  • SelectorExt to filter resources in an iteration
  • Examples of raw uses outside of ListParams

Fixes #1538

clux and others added 3 commits July 17, 2024 14:26
straight copy + factor out 2 std imports

Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
Copy link

codecov bot commented Jul 17, 2024

Codecov Report

Attention: Patch coverage is 89.79592% with 25 lines in your changes missing coverage. Please review.

Project coverage is 75.7%. Comparing base (e57b060) to head (32089f1).

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1539     +/-   ##
=======================================
+ Coverage   75.2%   75.7%   +0.5%     
=======================================
  Files         78      79      +1     
  Lines       6989    7234    +245     
=======================================
+ Hits        5249    5469    +220     
- Misses      1740    1765     +25     
Files Coverage Δ
kube-core/src/params.rs 85.6% <100.0%> (+1.1%) ⬆️
kube/src/lib.rs 88.5% <ø> (ø)
kube-runtime/src/watcher.rs 42.1% <0.0%> (-0.5%) ⬇️
kube-core/src/labels.rs 90.3% <90.3%> (ø)

@Danil-Grigorev Danil-Grigorev force-pushed the label-selector-support branch 8 times, most recently from c2c5a95 to 5ab3b6f Compare July 17, 2024 16:36
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 for doing this!
couple of quick initial comments, will think some more about it tomorrow

kube-core/src/labels.rs Outdated Show resolved Hide resolved
kube-core/src/labels.rs Outdated Show resolved Hide resolved
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.

quick doc suggestions if it works

kube-core/src/labels.rs Outdated Show resolved Hide resolved
kube-core/src/labels.rs Outdated Show resolved Hide resolved
@clux clux linked an issue Jul 18, 2024 that may be closed by this pull request
- Add SelectorExt to the prelude
- Remove Map in favor of more explicit BTreeMap<String, String>
- Add exmples of usage

Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
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.

q on error handling

gone through most of this now, looks really good!

kube-runtime/src/watcher.rs Show resolved Hide resolved
kube-core/src/labels.rs Outdated Show resolved Hide resolved
kube-core/src/labels.rs Show resolved Hide resolved
kube-core/src/labels.rs Outdated Show resolved Hide resolved
@clux clux added this to the 0.93.0 milestone Jul 19, 2024
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.

comments on exposed interfaces

kube-core/src/labels.rs Outdated Show resolved Hide resolved
kube-core/src/labels.rs Outdated Show resolved Hide resolved
kube-core/src/labels.rs Outdated Show resolved Hide resolved
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
- fmt fixes

Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
@Danil-Grigorev Danil-Grigorev force-pushed the label-selector-support branch 2 times, most recently from 11634fb to 5ee5933 Compare July 19, 2024 12:29
kube-core/src/labels.rs Outdated Show resolved Hide resolved
@Danil-Grigorev Danil-Grigorev force-pushed the label-selector-support branch 2 times, most recently from 212f730 to 2050c42 Compare July 19, 2024 12:49
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.

thought on the trait now that it's reduced a bit

kube-core/src/labels.rs Outdated Show resolved Hide resolved
@Danil-Grigorev Danil-Grigorev force-pushed the label-selector-support branch 2 times, most recently from 8e4d9ad to 1c37514 Compare July 19, 2024 15:54
- Implemented for Selector and Expression for now

Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
@clux clux merged commit 1816fd8 into kube-rs:main Jul 20, 2024
17 checks passed
@clux clux mentioned this pull request Jul 22, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add native to framework LabelSelector support More ergonomic ListParams::labels
3 participants