ROX-33188: Wire Sensor label providers for label-based policy scoping#19359
Draft
ROX-33188: Wire Sensor label providers for label-based policy scoping#19359
Conversation
|
Skipping CI for Draft Pull Request. |
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Both namespace label lookup methods (
NamespaceStore.LookupNamespaceLabelsByIDandnamespaceStore.LookupNamespaceLabelsByID) return the underlying label map directly; consider returning a cloned map to avoid accidental mutation of shared state by callers. - In
settingsToConfigMap, you always marshal/compress cluster labels even when the map is nil or empty; consider skippingClusterLabelsGZDataKeyin that case to reduce configmap size and align with thelen(data) == 0fast-path indecompressAndUnmarshalClusterLabels.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Both namespace label lookup methods (`NamespaceStore.LookupNamespaceLabelsByID` and `namespaceStore.LookupNamespaceLabelsByID`) return the underlying label map directly; consider returning a cloned map to avoid accidental mutation of shared state by callers.
- In `settingsToConfigMap`, you always marshal/compress cluster labels even when the map is nil or empty; consider skipping `ClusterLabelsGZDataKey` in that case to reduce configmap size and align with the `len(data) == 0` fast-path in `decompressAndUnmarshalClusterLabels`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
|
Images are ready for the commit at a4ec678. To use with deploy scripts, first |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #19359 +/- ##
==========================================
- Coverage 49.68% 49.63% -0.05%
==========================================
Files 2695 2702 +7
Lines 202847 203272 +425
==========================================
+ Hits 100777 100902 +125
- Misses 94550 94847 +297
- Partials 7520 7523 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Wire Sensor's in-memory stores as label providers for policy evaluation, enabling full label-based policy scoping (cluster + namespace labels) in both runtime detection and admission control.
Policies with
cluster_labelandnamespace_labelscopes now work in Sensor's runtime detection and admission control.User-facing documentation
Testing and quality
Automated testing
How I validated my change
Manual testing incoming after image builds.