-
Notifications
You must be signed in to change notification settings - Fork 762
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
No warning displayed on kubectl apply with enforcementAction warn #3302
Comments
@globalundo can you please share your ConstraintTemplate, constraint, and request that should have returned a warning? gatekeeper/pkg/webhook/policy.go Line 69 in 45e4552
|
@ritazh while preparing a minimal set of ConstraintTemplate, constraint, and request to reproduce the issue, I have managed to locate an exact issue:
Here's a minimal example:
Now, with enforcementAction:deny
However, with enforcementAction:warn only a single line violation message is present:
The multi-line warning message did work in previous OPA Gatekeeper version, but I can not pinpoint at after what version this has stopped working. |
I don't think Gatekeeper has changed any of its violation-reporting-via-webhook logic recently. Is this perhaps related to a Kubernetes or kubectl version change? |
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. |
Confirmed the problem with multi-line violation message. K8S server: v1.28.4 |
we were working through a different issue related to ISSUE-3216 where our violations show in audit but are not denied by the webhook. Gator CLI worked as it should but the Gatekeeper webhook allowed resources to be created. I was not able to duplicate this issue so in my opinion we can close it. |
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. |
What steps did you take and what happened:
enforcementAction: deny
, resource admission is denied on constraint violation, with a proper message onkubectl apply
enforcementAction: warn
, no warning message is displayed onkubectl apply
, even if resources violates the constraint/What did you expect to happen:
A warning message would be printed according to the Warn enforcement action.
Anything else you would like to add:
enforcementAction
is set to deny--log-denies
is set, a constrain violation get logged correctly on both warn and deny.kubectl --v=9
andGatekeeper’s --logdenies
, a constrain violation gets logged in stderr of the gatekeeper’s pod but kubectl does not get a HTTP 299 response but 201 insteadEnvironment:
The text was updated successfully, but these errors were encountered: