-
Notifications
You must be signed in to change notification settings - Fork 759
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: Sync annotation unmarshaling in gator #2734
feat: Sync annotation unmarshaling in gator #2734
Conversation
Signed-off-by: Anlan Du <adu47249@gmail.com>
f0fb385
to
ec6a457
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #2734 +/- ##
==========================================
+ Coverage 53.46% 53.53% +0.06%
==========================================
Files 127 128 +1
Lines 11373 11408 +35
==========================================
+ Hits 6081 6107 +26
- Misses 4817 4824 +7
- Partials 475 477 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Plz remove unneeded text and include a link to the doc. Or perhaps we need a meta-issue to link all the work to. |
pkg/gator/reader/read_constraints.go
Outdated
@@ -1,6 +1,7 @@ | |||
package reader |
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 generally LGTM but needs unit tests.
Some things we should test:
- converting a "compact representation" to an "expended representation". The pure function will make this test clearer.
- converting actual text on a fake template into a full SyncRequirements
- Some error scenarios where the annotation is malformed (someone's bound to mess up the formatting, particularly if the annotation picks up steam in the community)
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! Added tests--I think adding tests for ExpandCompactRequirements would be pretty redundant but lmk what you think
Signed-off-by: Anlan Du <adu47249@gmail.com>
Signed-off-by: Anlan Du <adu47249@gmail.com>
5bf981e
to
6f20882
Compare
Signed-off-by: Anlan Du <adu47249@gmail.com>
44f9bb7
to
1968f4c
Compare
Signed-off-by: Anlan Du <adu47249@gmail.com>
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.
This LGTM for now, thanks for working on this!
I'd love to see this being used in gator
to either generate SyncSets (probably going to happen later) or validate that a (constraint_template, constraint, config object)
tuple satisfies the requirements. This could help iron out any kinks and provide immediate value to gator
users.
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! Sorry for the slow review cycle
6d029ce
to
0998847
Compare
Signed-off-by: Anlan Du <adu47249@gmail.com>
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.
see suggestions, otherwise LGTM
Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com> Signed-off-by: Anlan Du <adu47249@gmail.com>
Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com> Signed-off-by: Anlan Du <adu47249@gmail.com>
Signed-off-by: Anlan Du <adu47249@gmail.com> Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com> Signed-off-by: Hy3n4 <hy3nk4@gmail.com>
In open-policy-agent/gatekeeper#2734 (comment) the decision was made to change the sync data anotation casing from `requiresSyncData` to `requires-sync-data`. This better fits k8s standards. This PR updates gatekeeper-library templates with the new annotation key. Signed-off-by: juliankatz <juliankatz@google.com>
What this PR does / why we need it:
Enables unmarshaling of the sync annotation into a struct
Design Doc
Special notes for your reviewer: