How to generate ConfigMap clone in each namespace #169
Replies: 5 comments 2 replies
-
Hi @domruf 👋 I don't believe that's a feature in Gatekeeper. If you really wanted to do something like that in "plain" OPA, you could use The idea behind OPA, and by extension Gatekeeper, is first and foremost to allow establishing policy-based guardrails around infrastructure, access control, kubernetes, and so on. Policy defines the rules for an environment, and violations are immediately reported back to the user as expected. Introducing "resource creation" (and to some extent, even mutation) in this context is basically saying that policy should not just define the rules, but also potentially disastrous side effects... which is ironically pretty much what a policy engine should protect against in the first place. To add to that, these side-effects are not reported back to the user, and unless clearly communicated out-of-band, they'll have no way of knowing that what they actually asked for is what eventually happened. Potentially useful? Maybe. |
Beta Was this translation helpful? Give feedback.
-
I haven't used it myself, but this looks like it could deal with specific automatic maintenance tasks like this: https://github.com/flant/shell-operator 💭 This looks promising, perhaps you can adapt it: configVersion: v1
kubernetes:
- name: execute_on_changes_of_namespace_labels
kind: Namespace
executeHookOnEvent: ["Modified"]
jqFilter: ".metadata.labels" |
Beta Was this translation helpful? Give feedback.
-
Thanks @anderseknert, I understand the argument that controlling policies and manipulate/creating resources to automatically fixing violations is not the same thing. I think my use case is quite common and the creation of resources would help a lot of people. I'll look into the http.send feature. |
Beta Was this translation helpful? Give feedback.
-
From what I'm seeing, asks for richer mutation and resource creation are driving the adoption of kyverno over gatekeeper. This would be a good topic to bring up in the community meeting, if you want deeper insight on how and why gatekeeper is like this. |
Beta Was this translation helpful? Give feedback.
-
Sorry for the late response.
|
Beta Was this translation helpful? Give feedback.
-
I have a 'ca-certificates.crt' file which is stored as a ConfigMap and is required in every namespace in my cluster.
I therefore want to generate a clone of my 'ca-certificates.crt' ConfigMap in each new namespace when the namespace is created or a new version of my helm chart is installed.
I worked with kyverno before and there it is possible to generate new resources https://kyverno.io/docs/writing-policies/generate/.
Is there an equivalate in OPA? So far I found nothing about this on https://open-policy-agent.github.io/gatekeeper/website/docs/
Beta Was this translation helpful? Give feedback.
All reactions