kubeshop / monokle-admission-controller

Kubernetes Admission Controller for enforcing policies in your clusters
https://monokle.io
MIT License
9 stars 1 forks source link

Monokle policies as CRDs #1

Closed f1ames closed 1 year ago

f1ames commented 1 year ago

This PR fixes https://github.com/kubeshop/monokle-saas/issues/1839, fixes https://github.com/kubeshop/monokle-saas/issues/1845.

Implemented MonoklePolicy and MonoklePolicyBinding according to https://github.com/kubeshop/monokle-saas/issues/1839#issuecomment-1738937312 and consistent (to some extend) with how VAP works.

Changes

Sample output (we can adjust wording there):

image

Fixes

To consider

I'm open for discussion/suggestions for any of the above.

Testing

See README.md with step-by-step instructions.

Checklist

olensmar commented 1 year ago

I really think we should reconsider our approach on namespaced admission controllers. Or maybe i did not understand the code and I might be wrong, but the approach where the controller can have an one "active policy" at a time is not looking reliable to me.

A better aproach, on a quick thought, would be creating a Map, 1-1 between a namespace and a policy (at first, later we can map resources to policies better should we want that and if it is possible). Now the Controller would have knowledge of all the policies and would be able to validate namespaced manifests.

totally agree - this would be configured in cloud, i.e. which policies apply to which resources - the selection could be based on

f1ames commented 1 year ago

Ok, discussed some technicalities with @murarustefaan to make sure I understand how admission controller should behave exactly, to summarize: