Open rbkaspr opened 3 years ago
Thanks for the feedback!
IIRC standard OPA policies use rule headers like:
deny[msg]
would keeping that same rule header but adding the Gatekeeper-specific:
violation[{"msg": msg}] {
deny[msg]
}
work for migrating without the need to refactor?
The reason for using an object-based return value was to leave room for returning machine-readable data so that we left open the possibility for things like automated remediation in the future.
Thanks for the response!
As it turns out, your suggested modification works like a charm. If it's important for planned future features of Gatekeeper, then I'm totally on board with the response structure as it stands, I would just like to see it called out a little more clearly on the documentation page for the benefit of those migrating from using standard OPA to Gatekeeper.
Same with the requirement for violation
instead of deny
, it's a convention you can pick up from the examples, but having it be called out more explicitly will probably help prevent confusion from those who may expect that they can just pick up their existing policy libraries from OPA and drop them into Gatekeeper without modification.
I'd be happy to contribute back a docs page to that effect, if need be.
This is documented in https://github.com/open-policy-agent/frameworks/tree/master/constraint#rule-schema but it's a very obscure location. This should be reflected in Gatekeeper docs too.
Yeah, buried in the docs pages of a completely different repo isn't exactly easy to find for people just getting started with Gatekeeper, especially if they don't also have a ton of experience with OPA (like a certain me).
If we could get that page replicated to the Gatekeeper repo, that would close this issue nicely.
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.
This still seems relevant
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:
What did you expect to happen: Based on just looking at standard OPA, I would expect violation[msg] to be a perfectly functional rule signature, but Gatekeeper requires a struct containing, at minimum, and msg key. Making that requirement much more explicit in the Gatekeeper docs would help, but it would be nice if Gatekeeper was able to handle normal OPA syntax rule signatures, if only to ease the transition as more people convert their existing OPA policy libraries over to running on Gatekeeper
Environment:
kubectl version
): v1.18.9-eks-d1db3c