Skip to content

feat: support label selectors for list operations - #362

Merged
matthyx merged 1 commit into
kubescape:mainfrom
ystkfujii:feat/list_opt
Aug 20, 2026
Merged

feat: support label selectors for list operations#362
matthyx merged 1 commit into
kubescape:mainfrom
ystkfujii:feat/list_opt

Conversation

@ystkfujii

@ystkfujii ystkfujii commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR adds label selector support to storage list operations.

Label selector support for GeneratedNetworkPolicy and other generated or aggregated resources will be addressed in the following issue:

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 68d61869-c4dd-4d69-ac60-288198e821b4


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@matthyx matthyx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this — the pagination + label/field selector matching logic looks correct, and the new TestStorageImpl_GetList_LabelSelectorWithPagination test does a good job exercising filtering across multiple pages of the underlying store.

A couple of things before this is ready to merge:

  • The PR is still marked draft, and the description leaves an open question about whether GeneratedNetworkPolicy and other generated/aggregated resources belong in this PR or a follow-up. That should be resolved (and the PR marked ready) before merging.
  • The branch is currently behind main — please rebase/update before merge.
  • Left one minor nit inline about code duplication between the two fetch branches.

No functional blockers found in the diff itself — holding off on approval only because of the draft status and the branch being behind base. Happy to approve once those are addressed.

Comment thread pkg/registry/file/storage.go Outdated
@ystkfujii
ystkfujii force-pushed the feat/list_opt branch 3 times, most recently from 0c81c2c to 9580f49 Compare August 19, 2026 17:05
Signed-off-by: ystkfujii <ystk.fujii0731@gmail.com>
@ystkfujii
ystkfujii marked this pull request as ready for review August 19, 2026 18:07
@ystkfujii

Copy link
Copy Markdown
Contributor Author

@matthyx

Thank you for the quick review!
I missed your review and force-pushed before I noticed it, which made the diff harder to follow 😅
Sorry about that.

When you have time, could you please take another look?

@ystkfujii
ystkfujii requested a review from matthyx August 19, 2026 18:08
@matthyx matthyx moved this to Needs Reviewer in KS PRs tracking Aug 20, 2026

@matthyx matthyx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good now — thanks for the update.

  • The duplication between the two fetch branches is gone; GetListWithConn now runs a single unified loop, and normalizeSelectionPredicate centralizes the nil-safety/GetAttrs check (fails fast with a clear error instead of silently dropping items).
  • The scope question is resolved: aggregated resources (GeneratedNetworkPolicy, config-scan/vulnerability summaries) explicitly force Label/Field to Everything() before paging their source objects, with a TODO + link to the follow-up (#363) rather than silently misapplying the selector.
  • Pagination logic re-checked and still correct against the test.

Only remaining nit: the branch shows as behind main — worth updating before merge, but not a blocker from a code standpoint. Approving.

@matthyx
matthyx merged commit b3970e3 into kubescape:main Aug 20, 2026
7 of 10 checks passed
@matthyx matthyx moved this from Needs Reviewer to To Archive in KS PRs tracking Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Archive

Development

Successfully merging this pull request may close these issues.

2 participants