-
Notifications
You must be signed in to change notification settings - Fork 36
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
WIP: add objectfilters #228
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: duncan485 <[email protected]>
Thanks @JaydipGabani , I'd say this also closes #24 |
@JaydipGabani Can this one be merged? |
@maxsmythe @ritazh @sozercan PTAL |
waiting for one more review at least. |
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #228 +/- ##
==========================================
+ Coverage 57.16% 62.83% +5.67%
==========================================
Files 1 1
Lines 572 479 -93
==========================================
- Hits 327 301 -26
+ Misses 181 114 -67
Partials 64 64
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Mapper: mgr.GetRESTMapper(), | ||
DefaultNamespaces: namespaces, | ||
}) | ||
ObjectFilers := make(map[client.Object]cache.ByObject) |
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.
ObjectFilers := make(map[client.Object]cache.ByObject) | |
objectFilers := make(map[client.Object]cache.ByObject) |
} | ||
} | ||
|
||
ObjectFilers[&corev1.Secret{}] = cache.ByObject{ |
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.
@duncan485 can we add tests for this?
While writing tests, I found that this doesn't work with multiple webhooks, it will only add the last added webhook in the filter. I'm putting this back in WIP, and continue this when I get to it. |
I ran into the issue that we cannot set resourceNames in (cluster)Role.rules.resourceNames because the cache/watch includes all the object of a kind in the selected namespace. This PR will limit the cache to only the secrets and webhooks that are needed for the cert-controller.
I tested this locally and verified it works, any feedback would be much appreciated.;