Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Use NativeType instead of DynType when binding request and namespaceObject #7

Open
fabriziosestito opened this issue Feb 1, 2024 · 0 comments

Comments

@fabriziosestito
Copy link
Contributor

fabriziosestito commented Feb 1, 2024

Is your feature request related to a problem?

ATM we are binding request and namespaceObject as DynType.
This is a workaround since recursively add sub-types to NativeTypes is not possible yet.
Instead, we need to bind our k8s-objects to the cel environment.
This allows the CEL compiler to type-check the expressions.

This WIP PR introduces the recursive NativeType: google/cel-go#892

Once the PR above is merged, we need to create a custom type provider based on the CEL NativeType.
This type will have the same behaviour of the vanilla NativeType, but it will convert downcase fields to uppercase. This is needed to be as close as possible to Kubernetes ValidatingAdmissionPolicy (which binds proto-generated objects instead).

Example:

namespaceObject.metadata -> namespaceObject.Metadata

Acceptance criteria

  • namespaceObject and request must be type-checked during the compilation. Unknwon fields and invalid types operations must raise an error at compile time.

Alternatives you've considered

Using proto-generated objects.
This alternative has been discarded because it's simpler to bind a NativeType based on kw k8s-objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant