-
Notifications
You must be signed in to change notification settings - Fork 496
Add regex support for namespace filtering #4554
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 regex support for namespace filtering #4554
Conversation
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
olsajiri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be easier to review if you split the generated changes to the separated commit, otherwise lgtm
c5ae960 to
60a2584
Compare
done. |
60a2584 to
8048331
Compare
mtardy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm as well, one nit, but either is good I imagine, it's mergeable like that, thanks for splitting into commits it looks great like that.
pkg/filters/namespace_regex_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe you can put this into the already existing namespace_test.go.
|
you need to satisfy the CI however, you might need to bundle the generated changes with the actual changes to make every commit to build. You'll need to generate docs etc. The output should be understandable |
Yes, for every commit to build, the generated changes should be bundled into a single commit. I didn’t think about that while splitting this.should I squash it back into one? The other CI failure looks like a gitHub status issue; there seems to be some disruption according to https://www.githubstatus.com/ . |
8048331 to
cd1c060
Compare
This commit adds a new field to the Filter protobuf message that allows filtering events by namespace using regular expressions.The field follows the same pattern as other regex fields like binary_regex and pod_regex. Signed-off-by: Aritra Dey <[email protected]>
Right now filtering events by namespace only works with exact matches. This is a problem when you have many namespaces that follow a pattern. This adds a new filter field called namespace_regex that lets users use regex instead. So now you can write patterns like 'prod-.*' or 'dev-.*' to match multiple namespaces at once. Signed-off-by: Aritra Dey <[email protected]>
This adds a new flag to the tetra CLI so users can test the namespace regex filter directly from the command line. Example: ``` tetra getevents --namespace-regex 'prod-.*' cat events.json | tetra getevents --namespace-regex 'prod-.*' -o compact ``` Signed-off-by: Aritra Dey <[email protected]>
This commit adds tests to verify the namespace regex filter works correctly. Signed-off-by: Aritra Dey <[email protected]>
cd1c060 to
07c3b9c
Compare
|
Updated now! the generated code(api changes) into its own commit and kept the regex logic in a separate commit. |
mtardy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome thanks
Description
This PR adds regex-based namespace filtering for events. Previously, the export allow/deny list only supported exact namespace matches, which made managing multiple similarly named namespaces difficult.(please review commit-wise).
Changelog