gatekeeper icon indicating copy to clipboard operation
gatekeeper copied to clipboard

No warning displayed on kubectl apply with enforcementAction warn

Open globalundo opened this issue 5 months ago • 3 comments

What steps did you take and what happened:

  • OPA Gatekeeper is installed in the k8s cluster
  • A constraint has been created
  • On enforcementAction: deny, resource admission is denied on constraint violation, with a proper message on kubectl apply
  • On enforcementAction: warn, no warning message is displayed on kubectl 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:

  • Gatekeeper has been deployed via gatekeeper.yaml
  • A proper message is printed when enforcementAction is set to deny
  • If --log-denies is set, a constrain violation get logged correctly on both warn and deny.
  • Based of kubectl --v=9 and Gatekeeper’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 instead
  • Any debugging tips or requests for an additional information are welcome

Environment:

  • Gatekeeper version: 3.13.0
  • Kubernetes version:
Client Version: v1.27.11
Kustomize Version: v5.0.1
Server Version: v1.27.9

globalundo avatar Mar 12 '24 09:03 globalundo