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

Investigate if CEL can validate that a list is sorted alphabetically #2462

Open
robscott opened this issue Oct 9, 2023 · 5 comments
Open
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@robscott
Copy link
Member

robscott commented Oct 9, 2023

What happened:
In #2461 we added a SupportedFeatures list to GatewayClass status. The spec requires that to be sorted alphabetically, but ideally we could also validate that with CEL. At first glance this appears to be impossible, but it would be good to get a more authoritative answer.

What you expected to happen:
Validation to enforce that this field is in alphabetical order.

cc @alexzielenski @cici37 @TristonianJones

@robscott robscott added the kind/bug Categorizes issue or PR as related to a bug. label Oct 9, 2023
@TristonianJones
Copy link

@robscott you would need to introduce custom functions to check sortedness, as CEL doesn't currently support this feature. It can definitely be done, especially if we supported index, value style comprehensions in CEL.

values.range(idx, v, idx == 0 || values[idx-1] <= v)

@robscott
Copy link
Member Author

robscott commented Oct 9, 2023

Thanks @TristonianJones! Are there any plans to support index, value style comprehensions in CEL? Do you happen to know if CRD authors have the flexibility to define custom functions or if those can only be added via upstream Kubernetes changes?

@shaneutt shaneutt added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 9, 2023
@k8s-triage-robot
Copy link

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

  • Confirm that this issue is still relevant with /triage accepted (org members only)
  • Close this issue with /close

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. and removed triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Oct 8, 2024
@TristonianJones
Copy link

@robscott CEL just added support for two variable comprehensions. I'll cut a release once in back from vacation, but they're in HEAD now

@robscott
Copy link
Member Author

robscott commented Oct 9, 2024

Very cool, thanks for the update @TristonianJones! Looking forward to seeing this in k8s.

/triage accepted

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

5 participants