Skip to content

Issue #187 - bug - gatekeeper expander - wrong event_type set for generated inform-gatekeeper-admission-* ConfigurationPolicy #188

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

Closed
wants to merge 1 commit into from

Conversation

itewk
Copy link

@itewk itewk commented Sep 26, 2024

Resolves issue #187

…ong event_type set for generated inform-gatekeeper-admission-* ConfigurationPolicy

Signed-off-by: Ian Tewksbury <[email protected]>
@dhaiducek
Copy link
Member

/hold

Copy link
Member

@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.

@itewk It's not actually incorrect. The event_type for admission events is indeed violation:

https://github.com/open-policy-agent/gatekeeper/blob/0a4851a975d25003218a23b8a70217f759f2454f/pkg/webhook/policy.go#L297

However, we'd welcome a contribution to add the violation_audit to the expander.

Copy link
Member

@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.

Thanks for catching that @dhaiducek!

Copy link

openshift-ci bot commented Sep 26, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: itewk
Once this PR has been reviewed and has the lgtm label, please ask for approval from dhaiducek. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

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

@openshift-ci openshift-ci bot removed the approved label Sep 26, 2024
@@ -110,7 +110,7 @@ func (g GatekeeperPolicyExpander) Expand(
"constraint_action": "deny",
"constraint_kind": constraintKind,
"constraint_name": constraintName,
"event_type": "violation",
"event_type": "violation_audited",
},
},
},
Copy link
Member

@dhaiducek dhaiducek Sep 26, 2024

Choose a reason for hiding this comment

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

The simplest thing might be to just add it as another object-template. What would you think of that, @itewk?

Suggested change
},
},
{
"complianceType": "mustnothave",
"objectDefinition": map[string]interface{}{
"apiVersion": "v1",
"kind": "Event",
"annotations": map[string]interface{}{
"constraint_action": "deny",
"constraint_kind": constraintKind,
"constraint_name": constraintName,
"event_type": "violation_audited",
},
},
},

Copy link
Author

Choose a reason for hiding this comment

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

yeah. but im also fighting with the hard coded namespaceSelector and the note left behind about "futer improvements needed". its annoying having namepsaces /excludedNamespaces set in my constraint (both at the gatekeeper and OPM level) but then those don't propigate to the generated ConfigurationPolicy(s) which ar harded cluded eclude/includes.

i am going to keep playing with it to see if i can get the behavor i would expect.

@itewk
Copy link
Author

itewk commented Sep 26, 2024

aaah. okay.

@itewk itewk closed this Sep 26, 2024
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.

3 participants