Skip to content
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: Gator sync test support #3098

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

anlandu
Copy link
Member

@anlandu anlandu commented Oct 21, 2023

What this PR does / why we need it:
Certain templates require replicating into OPA to enable correct evaluation. These templates can use the annotation metadata.gatekeeper.sh/requires-sync-data to indicate which resources need to be synced. This template annotation is descriptive, not prescriptive. The prescription of which resources to sync is done in SyncSet resources and/or the Gatekeeper Config resource. The management of these various requirements can get challenging as the number of templates requiring replicated data increases.

gator sync test aims to mitigate this challenge by enabling the user to verify their sync configuration is correct. The user passes in any number of Constraint Templates, SyncSets, and a Gatekeeper Config object, along with a GVK manifest listing the GVKs supported by the cluster under test, and the command will determine which requirements enumerated by the Constraint Templates are unfulfilled by the given SyncSet(s), Config, and/or manifest.

PRD

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
xref #2393

Special notes for your reviewer:

@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2023

Codecov Report

Attention: Patch coverage is 35.79545% with 226 lines in your changes missing coverage. Please review.

Project coverage is 47.74%. Comparing base (3350319) to head (bd0c922).
Report is 147 commits behind head on master.

Files with missing lines Patch % Lines
apis/gvkmanifest/v1alpha1/zz_generated.deepcopy.go 0.00% 105 Missing ⚠️
pkg/gator/reader/read_resources.go 0.00% 58 Missing ⚠️
cmd/gator/sync/test/test.go 0.00% 25 Missing ⚠️
pkg/gator/sync/test/test.go 79.34% 12 Missing and 7 partials ⚠️
pkg/cachemanager/parser/syncannotationreader.go 30.00% 14 Missing ⚠️
cmd/gator/sync/sync.go 0.00% 5 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (3350319) and HEAD (bd0c922). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (3350319) HEAD (bd0c922)
unittests 2 1
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3098      +/-   ##
==========================================
- Coverage   54.49%   47.74%   -6.76%     
==========================================
  Files         134      225      +91     
  Lines       12329    15495    +3166     
==========================================
+ Hits         6719     7398     +679     
- Misses       5116     7277    +2161     
- Partials      494      820     +326     
Flag Coverage Δ
unittests 47.74% <35.79%> (-6.76%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anlandu
Copy link
Member Author

anlandu commented Oct 23, 2023

@julianKatz @acpana

@julianKatz julianKatz self-requested a review October 23, 2023 20:21
Copy link
Contributor

@acpana acpana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good 💯 !! Thanks for working on it.

A few questions and suggestions.

cmd/gator/sync/sync.go Outdated Show resolved Hide resolved
cmd/gator/sync/sync.go Outdated Show resolved Hide resolved
cmd/gator/sync/sync.go Outdated Show resolved Hide resolved
cmd/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
cmd/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
pkg/gator/sync/verify/verify_test.go Outdated Show resolved Hide resolved
pkg/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
pkg/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
pkg/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
pkg/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
@anlandu anlandu requested a review from acpana October 23, 2023 20:48
cmd/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
cmd/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
cmd/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
pkg/gator/fixtures/fixtures.go Show resolved Hide resolved
pkg/gator/fixtures/fixtures.go Outdated Show resolved Hide resolved
pkg/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
pkg/gator/sync/verify/verify.go Outdated Show resolved Hide resolved
pkg/gator/sync/verify/verify_test.go Outdated Show resolved Hide resolved
website/docs/gator.md Outdated Show resolved Hide resolved
website/docs/gator.md Outdated Show resolved Hide resolved
@anlandu anlandu requested a review from a team as a code owner November 4, 2023 00:19
@anlandu anlandu changed the title feat: Gator sync verify support feat: Gator sync test support Nov 9, 2023
Signed-off-by: Anlan Du <[email protected]>
@anlandu
Copy link
Member Author

anlandu commented Jan 22, 2024

Thanks for all the comments so far, let me know if you have any thoughts @ritazh @sozercan @maxsmythe!

Copy link

stale bot commented Mar 22, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 22, 2024
@stale stale bot removed the stale label Apr 5, 2024
Copy link

stale bot commented Jun 25, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 25, 2024
@stale stale bot removed the stale label Jun 25, 2024
Copy link

stale bot commented Aug 24, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 24, 2024
@sozercan
Copy link
Member

sozercan commented Sep 4, 2024

@anlandu are you still interested in getting this to be merged?

@stale stale bot removed the stale label Sep 4, 2024
@anlandu
Copy link
Member Author

anlandu commented Sep 4, 2024

@sozercan yep! Happy to update the branch and address any comments anyone has, or Alex and Julian took a pretty thorough look so I can just merge it without waiting for another review

@ritazh
Copy link
Member

ritazh commented Sep 5, 2024

@anlandu looks like there are some lint and unit test failures. can you PTAL?

@anlandu
Copy link
Member Author

anlandu commented Sep 17, 2024

@anlandu looks like there are some lint and unit test failures. can you PTAL?

@ritazh sorry for the delay during oncall! I've fixed them now

Co-authored-by: Rita Zhang <[email protected]>
Signed-off-by: Anlan Du <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants