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

Set sync setting in config automatically #18

Merged

Conversation

yiraeChristineKim
Copy link

@yiraeChristineKim yiraeChristineKim commented Sep 29, 2023

Description: The gatekeeper operator exposes a setting in the CRD under audit named auditFromCache. By default this cache is Disabled. If you set it to Enabled, you break your constraints because the cache requires additional settings in the CRD configs.config.gatekeeper.sh for the sync details.

The problem (my opinion here) is that if we expose the ability to enable the cache in the operator we must also expose the ability to configure the cache with the sync details.

Ref: https://issues.redhat.com/browse/ACM-7065

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@yiraeChristineKim yiraeChristineKim force-pushed the ACM-7065-new branch 2 times, most recently from e9e01ab to 6c21610 Compare October 2, 2023 15:05
controllers/constraintstatus_controller.go Show resolved Hide resolved
controllers/constraintstatus_controller.go Outdated Show resolved Hide resolved
test/e2e/e2e.go Outdated Show resolved Hide resolved
test/e2e/util/util.go Show resolved Hide resolved
Copy link

@dhaiducek dhaiducek left a comment

Choose a reason for hiding this comment

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

Wow! This is quite the PR, @yiraeChristineKim! I need to look at the E2E test and look through the Gatekeeper docs to figure out the pieces here and the details on what it's doing, but it'll be a powerful addition to the operator!

I have some comments/questions that I thought I'd leave in the meantime.

.github/workflows/ci_tests.yaml Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
controllers/constraintstatus_controller.go Outdated Show resolved Hide resolved
controllers/constraintstatus_controller.go Outdated Show resolved Hide resolved
controllers/constraintstatus_controller.go Outdated Show resolved Hide resolved
controllers/gatekeeper_controller.go Outdated Show resolved Hide resolved
test/resources/case1_audit_from_cache/template.yaml Outdated Show resolved Hide resolved
Copy link

@mprahl mprahl left a comment

Choose a reason for hiding this comment

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

Great test coverage. This PR is getting really close!


constraintMatchKinds, _, err := unstructured.NestedSlice(constraint.Object, "spec", "match", "kinds")
if err != nil {
r.Log.V(1).Info("There are no provided kinds in the Contsraint", "constraintName:", constraintName)
Copy link

Choose a reason for hiding this comment

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

Suggested change
r.Log.V(1).Info("There are no provided kinds in the Contsraint", "constraintName:", constraintName)
r.Log.V(1).Info("There are no provided kinds in the Constraint", "constraintName:", constraintName)

cpsMgr, err := ctrl.NewManager(r.KubeConfig, ctrl.Options{
Scheme: r.Scheme,
Metrics: server.Options{
BindAddress: ":0",
Copy link

Choose a reason for hiding this comment

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

Copy link

@mprahl mprahl left a comment

Choose a reason for hiding this comment

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

Nice job!

@openshift-ci openshift-ci bot added the lgtm label Dec 1, 2023
Copy link

openshift-ci bot commented Dec 1, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mprahl, yiraeChristineKim

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [mprahl,yiraeChristineKim]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit eebbde6 into stolostron:main Dec 1, 2023
6 checks passed
@yiraeChristineKim
Copy link
Author

/cherrypick release-3.14

@openshift-cherrypick-robot

@yiraeChristineKim: new pull request created: #32

In response to this:

/cherrypick release-3.14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@yiraeChristineKim
Copy link
Author

/cherrypick release-3.11

@openshift-cherrypick-robot

@yiraeChristineKim: #18 failed to apply on top of branch "release-3.11":

Applying: Set sync setting in config automatically
.git/rebase-apply/patch:1087: trailing whitespace.
## 11. Updating the gatekeeper Go module 
.git/rebase-apply/patch:1089: trailing whitespace.
### Update gatekeeper package according to gatekeeper version 
warning: 2 lines add whitespace errors.
Using index info to reconstruct a base tree...
M	.github/workflows/ci_tests.yaml
M	Makefile
M	deploy/gatekeeper-operator.yaml
M	go.mod
M	go.sum
M	main.go
A	test/e2e/e2e_suite_test.go
A	test/e2e/gatekeeper_controller_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/gatekeeper_controller.go
Auto-merging test/e2e/e2e.go
CONFLICT (content): Merge conflict in test/e2e/e2e.go
Auto-merging main.go
CONFLICT (content): Merge conflict in main.go
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
Auto-merging deploy/gatekeeper-operator.yaml
Auto-merging Makefile
CONFLICT (content): Merge conflict in Makefile
Auto-merging .github/workflows/ci_tests.yaml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Set sync setting in config automatically
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-3.11

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants