Closed flavio closed 3 years ago
Unless I'm misunderstanding I wouldn't do this at this time. Currently, we have a Runtime
enum, and based on the variant, the validate
or validate_settings
on the Runtime
type will behave differently.
This is not a case of different types having to implement a common interface. Please, tell me if I'm missing anything here.
We discussed a possible alternative to this approach: create two structs that "hold" the functions needed by the evaluation. Then have the enum use the right struct.
This is a middle-ground solution, we can iterate over that if we're unhappy
Right now policy-evaluator has to runtimes: waPC (the original one) and burrego (the one that handles OPA and Gatekeeper policies).
The current codebase deals with that by using some
match
statements (basically Rust equivalent of aswitch
). This makes the code ugly and hard to maintain.We can remove this complexity by using some Rust traits.
For more details about the pieces of the code that have to be updated, take a look at the comments against this PR: https://github.com/kubewarden/policy-evaluator/pull/22