yonahd / kor

A Golang Tool to discover unused Kubernetes Resources
MIT License
1.04k stars 96 forks source link

fix: ClusterRole Aggregation #221

Closed sempex closed 8 months ago

sempex commented 8 months ago

Kubernetes Supports ClusterRole Aggregation, enabling the aggregation of one ClusterRole into another. For more details, refer to the official Kubernetes Documentation here.

This functionality allows a ClusterRole lacking a ClusterRoleBinding or a RoleBinding to remain usable. Currently, Kor does not handle this scenario. Consequently, the ClusterRoles in use are not properly listed through Kor. The proposed Pull Request addresses this issue.

yonahd commented 8 months ago

Hi @sempex Thank for the pr. Can you please add a test for this?

sempex commented 8 months ago

Hi @sempex Thank for the pr. Can you please add a test for this?

Sure will try to add one 👍

sempex commented 8 months ago

@yonahd I added my changes to the testcases

codecov-commenter commented 8 months ago

Codecov Report

Attention: Patch coverage is 60.60606% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 47.58%. Comparing base (c421565) to head (5b58559).

Files Patch % Lines
pkg/kor/clusterroles.go 55.17% 8 Missing and 5 partials :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #221 +/- ## ========================================== + Coverage 47.48% 47.58% +0.09% ========================================== Files 32 32 Lines 2883 2915 +32 ========================================== + Hits 1369 1387 +18 - Misses 1345 1354 +9 - Partials 169 174 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sempex commented 8 months ago

Looks good! A couple small comments

Fixed it 🚀