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

feat: mvp #5

Merged
merged 8 commits into from
Feb 1, 2024
Merged

feat: mvp #5

merged 8 commits into from
Feb 1, 2024

Conversation

fabriziosestito
Copy link
Contributor

@fabriziosestito fabriziosestito commented Jan 31, 2024

Description

This is the MVP of a policy that can run CEL expression.
It accepts variables and validations with the same syntax as the ValidatingAdmissionPolicy Kubernetes resource.
It acts as a DSL, meaning that creating new policies is possible by configuring new settings and it does not need compilation or wasm toolkit.
The policy requires context-aware capabilities since it needs to get the namespace object of the request to populate the namespaceObject variable.

Test

Settings validation unit tests are adapted from the Kubernetes codebase.
Furthermore, Validation unit tests and e2e tests are added.

Additional Information

Tradeoff

At the moment the policy does not support:

  • authz extension: we need to implement this extension by using context-aware capabilities
  • typed namespace object and request variables: waiting for this PR to be merged: ext.NativeTypes: Recursively add sub-types google/cel-go#892 so we can bind our k8s-objects to the CEL environment as types
  • third-party package: cherry-picking cel extensions from the Kubewarden codebase was needed to reduce the wasm binary size, this could be changed to a fork and automated.

Copy link
Member

@flavio flavio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats, that quite an achievement! 👏

I left some minor notes, but I think this is good to be merged and released

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
internal/cel/cel.go Outdated Show resolved Hide resolved
internal/cel/cel.go Show resolved Hide resolved
metadata.yml Outdated Show resolved Hide resolved
renovate.json Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
metadata.yml Outdated Show resolved Hide resolved
Copy link
Member

@viccuad viccuad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, congrats :).

Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Co-authored-by: José Guilherme Vanz <jvanz@jvanz.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
@flavio
Copy link
Member

flavio commented Feb 1, 2024

LGTM, thanks for having implemented also Quantity

Ship it! 🚀

@fabriziosestito fabriziosestito merged commit af48bd6 into kubewarden:main Feb 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants