k-cloud-labs / kinitiras

A programmable rule engine for k8s admission webhook
https://k-cloud-labs.github.io/kinitiras-doc
Apache License 2.0
158 stars 10 forks source link

Refactor template policy module form cue to go code #17

Open yusank opened 1 year ago

yusank commented 1 year ago

Is your feature request related to a problem? Please describe. There are some performance issues when execute huge cue code and it seems didn't solve any problem when we use render template to cue code.

Describe the solution you'd like We should handle template logic during runtime, since all template logic are predictable and there are less performance issues when we use go. We can define a interface like this:

type TemplateExecuter interface {
    Execute(ctx context.Context, obj any, t Template) error
}

and we implement it based on template type, instead of render and excute cue.

Describe alternatives you've considered

Additional context