-
Notifications
You must be signed in to change notification settings - Fork 96
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
Feat: Discover unused RoleBindings #362
Feat: Discover unused RoleBindings #362
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #362 +/- ##
==========================================
+ Coverage 44.43% 44.48% +0.05%
==========================================
Files 61 63 +2
Lines 3241 3356 +115
==========================================
+ Hits 1440 1493 +53
- Misses 1574 1622 +48
- Partials 227 241 +14 ☔ View full report in Codecov by Sentry. |
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.
Overall looks good.
Regarding the users and groups I agree with your implementation, we will now mark as used as we prefer this option over false positives
One comment from a quick glance, relating both cmd & multi - For easier maintenance I'd suggest to remove it, see #300 for further reference. |
As for users/groups - you're right, Kubernetes vanilla on its own doesn't store this data, as other distros like OpenShift do. We'll address that separately as you suggested, also relating for the future PR to map unused ClusterRoleBindings. |
LGTM |
What this PR does / why we need it?
This is a partial PR as I ran into challenges validating whether User or Group subjects exist. As you likely know, Kubernetes doesn’t store user or group information in its resources. I could use your input—am I missing something? How can we reliably verify the existence of a user or group?
Currently, a RoleBinding is considered unused if it references a non-existent Role, ClusterRole, or if none of its ServiceAccount subjects are valid.
We might consider merging this PR as is and opening a separate issue to address User and Group validation—I'll leave that decision to you.
PR Checklist
GitHub Issue
Closes #334
Notes for your reviewers