Utilizing constraint framework for plain OPA running on K8S #243
Replies: 1 comment 2 replies
-
I'm glad you like it! Before diving in to brainstorming, some clarification on the behavior/infrastructure of Gatekeeper/Constraint Framework:
This is true in the strictest sense (since I don't think this leads to a single constraint template with multiple targets), but it would mean creating a new target to feed into the constraint framework (which has been done before, see terraform-validator. It would be helpful to know a bit more about the specifics of your policy goals and maybe see some example content of what an inbound envoy authz request would look like to make this discussion more concrete.
This is true. I took a brief glance at Envoy authorization. It looks like this is the schema for Envoy's authorization requests? Assuming that's true, the rough work would be as follows:
The biggest questions would be as-follows:
@ritazh @sozercan @shomron In case you find this interesting. |
Beta Was this translation helpful? Give feedback.
-
My Use-case:
I started looking into OPA-envoy and Gatekeeper recently, for a policy enforcement solution.
I want to deploy Envoy API GW and OPA as a sidecar in a K8S cluster and I expect to have multiple policies that are similar in nature and might change frequently.
I really liked the way Gatekeeper manages policies (ConstraintTemplate and Constraint CRDs) within K8S but I still want the policy enforcement to occur on the Envoy API GW layer, meaning before reaching K8S API (so not as an admission controller).
My ideal solution would be to defined a set of constraints as K8S object (the way Gatekeeper works), but have an OPA-envoy instance running as a sidecar container to envoy that would get the rego policies from the constraints CRs and enforces them – so kind of like gatekeeper with all of its controllers but without the whole admission controller stuff.
Some background (according to my understanding):
It is still very common to deploy plain OPA on a k8s environment, as a sidecar to envoy or different applications for policy enforcement. In that case you need to create the policies as config maps, or have a bundle server running, this is not great because it is hard to manage the policies that way, you can have a lot of code duplication between the policies, and you basically miss out on all the great things gatekeeper and constraint framework has to offer as a K8S user.
It would be great if there was a way to configure gatekeeper to integrate with a different OPA instances in the same K8S cluster, meaning have the gatekeeper controllers push the policy and data to different OPA instances in the cluster.
I looked briefly at gatekeeper and I get the feeling that most of the hard parts are implemented already, and I think that this could have huge value for K8S users.
P.S,
[1] https://github.com/open-policy-agent/frameworks/tree/master/constraint
[2] https://openpolicyagent.slack.com/archives/CDTN970AX/p1658844157716909
[3] #204
Beta Was this translation helpful? Give feedback.
All reactions