You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-api-machinery/2876-crd-validation-expression-language/README.md
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -361,9 +361,10 @@ Proposal:
361
361
- Keep all the CEL standard functions and macros as well as the extended string library.
362
362
- Introduce a new "kubernetes" CEL extension library.
363
363
- Add `isSorted` for lists with comparable elements. This is useful for ensuring that a list is kept in-order.
364
-
- Add `sum`, `min` and `max` functions for lists of summable/comparable elements. This is the
365
-
core set of aggregate functions for lists, with CEL they can also be used on scalars by using defining list literals
366
-
inline , e.g. `[self.val1, self.val2].max()`
364
+
- Add `sum` for lists of {int, uint, double, duration, string, bytes} (consistent with the [CEL _+_ operation](https://github.com/google/cel-spec/blob/master/doc/langdef.md#list-of-standard-definitions) )
365
+
and add `min`, `max` for lists of {bool, int, uint, double, string, bytes, duration, timestamp} (consistent with the [CEL comparison operations](https://github.com/google/cel-spec/blob/master/doc/langdef.md#list-of-standard-definitions)).
366
+
These operations can also be used in CEL on scalars by defining list literals
367
+
inline , e.g. `[self.val1, self.val2].max()`. Overflow will raise the same error raised by arithmetic operation [overflow](https://github.com/google/cel-spec/blob/master/doc/langdef.md#overflow).
367
368
- Add `indexOf` / `lastIndexOf` support for lists (overloading the existing string functions), this can be useful for
368
369
validating partial order (i.e. the tasks of a workflow)
369
370
@@ -393,7 +394,7 @@ CEL standard [macros](https://github.com/google/cel-spec/blob/master/doc/langdef
393
394
- `filter`
394
395
395
396
CEL [extended string function library](https://github.com/google/cel-go/blob/master/ext/strings.go) includes:
396
-
-
397
+
397
398
- `charAt`
398
399
- `indexOf`, `lastIndexOf`
399
400
- `upperAscii`, `lowerAscii`
@@ -468,6 +469,8 @@ of any future work done involving CEL and mutating admission control:
468
469
Any changes to the CEL function library will make it possible for CRD authors to create CRDs that are incompatible with
469
470
all previous Kubernetes releases that supported CEL. Because of this incompatibility, changing the function library
470
471
will need to carefully considered and kept to a minimum. All changes will need to be limited to function additions.
472
+
We will not add functions to do things that can already be accomplished with existing functions. Improving ease-of-use
473
+
at the cost of fragmentation / incompatibility with older servers is not a good trade-off.
471
474
472
475
Any function library change must follow the [API Changes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md)
473
476
guidelines. Since a change to the function library is a change to the `x-kubernetes-validations.rule` field, it must be
@@ -480,15 +483,16 @@ introduced one Kubernetes release prior to when it may be included in create/upd
480
483
481
484
The mechanism for this will be:
482
485
483
-
- All new functions, macros, or overloads of existing functions, will be added to a separate "kubernetes-future-compatibility" CEL extension library. (Better naming suggestions welcome).
486
+
- All new functions, macros, or overloads of existing functions, will be added to a separate "future compatibility" CEL
487
+
extension library (which extension library a function is in is an internal detail that is not visible to users).
484
488
- For create requests, and for any CEL expressions that are changed as part of an update, the CEL expression will be
485
-
compiled **without** the "kubernetes-future-compatibility" CEL extension.
489
+
compiled **without** the "futurecompatibility" CEL extension library.
486
490
- For CEL expressions not changed in an update, the CEL expression will be compiled **with** the
487
491
"kubernetes-future-compatibility"CEL extension. This ensures that persisted fields that already use the change continue
488
492
to compile.
489
-
- The "kubernetes-future-compatibility" CEL extension will always be included when CEL expressions are evaluated.
490
-
- When the next version of Kubernetes is release, the library functions are be moved from "kubernetes-future-compatibility"
491
-
- to the "kubernetes" library.
493
+
- The "futurecompatibility" CEL extension library will always be included when CEL expressions are evaluated.
494
+
- When the next version of Kubernetes is release, the library functions will be moved from "futurecompatibility"
495
+
- to the main CEL extension library we use to extend CEL for Kubernetes.
0 commit comments