snowdrop / team

Repository hosting daily tasks, general information, wiki, tricks, ...
3 stars 0 forks source link

Generic Validations in Admission Controllers #825

Open csviri opened 2 years ago

csviri commented 2 years ago

Introduction

When implementing a validation webhook it would be handy to as easily express the rules as possible. The main goal here is (at least in first iterations) make it trivial to write validation hooks for kubernetes. We already simplified the to implement a validation hook, the main question is how to express rules more elegantly. Currently the appraoch is very open, see:

https://github.com/java-operator-sdk/admission-controller-framework/blob/4ddf69fe3717cdfa811ee53af92c5cfa8c352ce6/samples/spring-boot/src/main/java/io/javaoperatorsdk/admissioncontroller/sample/springboot/Config.java#L32-L36

There are more generic validation frameworks available, one is OPA Where users can write validations in rego language. Unfortunatelly it not trivial to learn this language (is basically a datalog/prolog).

Why might find an easier alternative, especially for java developers might be much easier to express such rules with some standard validation approaches. Unfortunately bean validation usage is limited here, since for POJOs we use ones from fabric8 client, so bean validation works nicely just for custom resources.

Goal

See issue in the framework: https://github.com/java-operator-sdk/admission-controller-framework/issues/3

cmoulliard commented 2 years ago

When implementing a validation webhook it would be handy to as easily express the rules as possible.

csviri commented 2 years ago

Updated the description. Yes, the main goal of this issues is basically choose and implement the usage such a solution.