generated from crossplane/function-template-go
-
Notifications
You must be signed in to change notification settings - Fork 2
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 extended functions for data manipulation in CEL expressions #22
Open
aerfio
wants to merge
3
commits into
crossplane-contrib:main
Choose a base branch
from
aerfio:aerfio/add-more-cel-opts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,5 @@ | |
|
||
# Go workspace file | ||
go.work | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you land on this set of options? Is it pretty much what the Kubernetes API server uses? I'm wondering if there's some good way to document them without necessarily going so far as a comment for each option.
Also, do you know if these are all backward compatible? Could any of them break an existing function usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it's still a draft PR and in a miserable shape, I'm still experimenting 😅. But ok, my current thought process is to add all extended functions from k8s codebase, because then writing CEL expressions would match the dev experience of writing CEL rules for CRDs. So I'd add all/most of functions from
k8s.io/apiserver/pkg/cel/library
and some fromgithub.com/google/cel-go/cel
andgithub.com/google/cel-go/ext
, at least those that you can find in this slice: https://github.com/kubernetes/kubernetes/blob/v1.29.3/staging/src/k8s.io/apiserver/pkg/cel/environment/base.go#L49I'm not sure whether adding more validation rules would be a breaking change, probably yeah but this project is still at v0.1.1 so I guess it's good time for that 🤷🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha no pressure, I was just curious. 🙂
By the way we definitely need more maintainers on this function. I'd be happy to add you if it's something you're passionate about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not experienced in CEL expressions at all and neither in cel-go library :P I just used it in my private project once, in a custom crossplane provider-k8s where I used it to allow users to derive readiness of underlying object by passing a CEL expression, see https://github.com/aerfio/provider-k8s/blob/4610c123ea33f8c3faa45036318681eb817aa492/examples/sample/deploy.yaml#L33. In my project the CEL environment creation is almost the same as here, it's a bit worse because I dont reuse
cel.Env
. But that was only a PoC project, made for fun with 0 users :PSo back to the point: I think I dont have enough experience in CEL related stuff to get maintainer status, but feel free to ping me in the future 👍🏻