-
Notifications
You must be signed in to change notification settings - Fork 187
✨ Adds ability to not filter CRDS, see ISSUE #373 #374
Conversation
Thanks for opening this pull request! Please check out our contributing guidelines and sign the CLA. |
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.
Thanks for your PR! Could you please document the new flag in the README. Perhaps something like:
"By default, kubeaudit will ignore generated resources (such as Pods generated by Deployments). If you would like kubeaudit to produce results for generated resources (for example if you have custom resources or want to catch orphaned resources where the owner resource no longer exists) you can use this flag."
Perfect thanks! As for testing, I can look into adding a test next week. If you'd like to try it out yourself, I'm thinking of doing something similar to https://github.com/Shopify/kubeaudit/blob/main/internal/test/test.go#L111-L114 with a new test fixture and then seeing if the report results contains the pods or not (or even just comparing the number of results). You can use But definitely don't feel like you need to do all that, as I said I'm happy to add the testing portion. |
I'll try to get the unit tests to work, but if you beat me to it go ahead. I'm trying to figure out how to not run ALL the unit tests everytime. |
ok, had a look at the unit tests. it appears that the file name for the current loaded objects represent the namespace used to test each object. There's a bit of structural issue here with the testing framework that requires a better familiarity with Go and the unit tests here than I feel comfortable tackling right now. I am interested to see how you solve it though. |
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.
Ok I wrote out a test locally and it passes 🎉 . Since I can't push to your branch let's get your PR merged and I'll add the test as a separate PR.
Description
Adds new command flag to not filter out generated resources, which unfortunately also can include CRD based resources (like a CRD based on
Application
)Fixes #373
Type of change
How Has This Been Tested?
I ran it against my cluster and compared results with the flag on and off and found a lot more issues with the flag, which was my intent.
Checklist:
It is kind of difficult to test if these changes work or not, since they only apply to querying remote clusters and not local files. If you guys have a suggestion for me to add test cases, I'm happy to help or learn.