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

Add CEL expression support #562

Open
kumar-mallikarjuna opened this issue Sep 11, 2024 · 3 comments · May be fixed by #576
Open

Add CEL expression support #562

kumar-mallikarjuna opened this issue Sep 11, 2024 · 3 comments · May be fixed by #576

Comments

@kumar-mallikarjuna
Copy link
Contributor

kumar-mallikarjuna commented Sep 11, 2024

What would you like to be added:
A Common Expression Language (CEL) based assertion semantic.

The Common Expression Language (CEL) provides a standardized way to evaluate expressions, facilitating easier interoperability between different applications.

Reference: https://github.com/google/cel-spec

Why is this needed:

Currently, Kuttl lacks support for complex data manipulation in assertions. Here are a few examples where this limitation is apparent:

These issues could be resolved by incorporating a CEL engine into Kuttl, allowing for expression evaluation and more flexible assertions.

How would this look like syntactically:

apiVersion: kuttl.dev/v1beta1
kind: TestAssert
celAssert:
  resources:
    - apiVersion: apps/v1
       kind: Deployment
       name: coredns
       namespace: kube-system
       id: resource
  expression: "resource.status.readyReplicas > 1"

Edit: Incorporate the comments from @porridge .

@porridge
Copy link
Member

I totally agree with the rationale. Kuttl definitely needs more powerful assertion capabilities.
Discussions on how to best express this never concluded.
I actually like how chainsaw solved this, some of the things there don't really look like YAML any more 😆

Your suggestion looks functional, even if somewhat different from how assertions are currently expressed in kuttl.

I wonder if you could write up a really short KEP do describe this and announce on the slack channel, to give others a chance to comment?

Personally I'd just maybe use id instead of identifier and put this into TestAssert rather than TestStep.

@eddycharly
Copy link
Contributor

I have plan to support CEL in chainsaw, didn't have time to work on it yet though :(

@kumar-mallikarjuna
Copy link
Contributor Author

Sure, will do, @porridge .

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

Successfully merging a pull request may close this issue.

3 participants