Skip to content

Commit 4adef38

Browse files
committed
Remove obsolete escaping rule info
1 parent 02e9602 commit 4adef38

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

keps/sig-api-machinery/2876-crd-validation-expression-language/README.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ Example Validation Rules:
229229
230230
| Rule | Purpose |
231231
| ---------------- | ------------ |
232-
| `self.minReplicas <= self.replicas <= self.maxReplicas` | Validate that the three fields defining replicas are ordered appropriately |
232+
| `self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas` | Validate that the three fields defining replicas are ordered appropriately |
233233
| `'Available' in self.stateCounts` | Validate that an entry with the 'Available' key exists in a map |
234234
| `(size(self.list1) == 0) != (size(self.list2) == 0)` | Validate that one of two lists is non-empty, but not both |
235235
| `!('MY_KEY' in self.map1) || self['MY_KEY].matches('^[a-zA-Z]*$')` | Validate the value of a map for a specific key, if it is in the map |
@@ -305,10 +305,6 @@ like the `all` macro, e.g. `self.all(listItem, <predicate>)` or `self.all(mapKey
305305
- xref [analysis of possible interactions with immutability and
306306
validation](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1101-immutable-fields#openapi-extension-x-kubernetes-immutable).
307307

308-
- If a object property name is a CEL keyword (see RESERVED in [CEL Syntax](https://github.com/google/cel-spec/blob/master/doc/langdef.md#syntax)),
309-
it will be escaped by prepending a _ prefix. To prevent this from causing a subsequent collision, properties named with a CEL keyword and a `_` prefix will be
310-
prefixed by `__` (generally, N+1 the existing number of `_`s).
311-
312308
- Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible and are escaped
313309
according to the following rules when accessed in the expression:
314310
- `__` escapes to `__underscores__`
@@ -504,32 +500,32 @@ coverage of interactions in these dimensions:
504500

505501
Types:
506502

507-
| OpenAPIv3 type | CEL type |
508-
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
509-
| 'object' with Properties | object / "message type" |
510-
| 'object' with AdditionalProperties | map |
511-
| 'object' with x-kubernetes-embedded-type | <treatment is the same as 'object' more details below> |
512-
| 'object' with x-kubernetes-preserve-unknown-fields | <treatment is the same as 'object', more details below> |
513-
| x-kubernetes-int-or-string | dynamic object that is either an int or a string, `type(value)` can be used to check the type |
514-
| 'array | list |
515-
| 'array' with x-kubernetes-list-type=map | list with map based Equality & unique key guarantees |
516-
| 'array' with x-kubernetes-list-type=set | list with set based Equality & unique entry guarantees |
517-
| 'boolean' | boolean |
518-
| 'number' (all formats) | double |
519-
| 'integer' (all formats) | int (64) |
520-
| 'null' | null_type |
521-
| 'string' | string |
522-
| 'string' with format=byte (base64 encoded) | bytes |
523-
| 'string' with format=date | timestamp (google.protobuf.Timestamp) |
524-
| 'string' with format=datetime | timestamp (google.protobuf.Timestamp) |
525-
| 'string' with format=duration | duration (google.protobuf.Duration) |
503+
| OpenAPIv3 type | CEL type |
504+
| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
505+
| 'object' with Properties | object / "message type" |
506+
| 'object' with AdditionalProperties | map |
507+
| 'object' with x-kubernetes-embedded-type | object / "message type", 'apiVersion', 'kind', 'metadata.name' and 'metadata.generateName' are implicitly included in schema |
508+
| 'object' with x-kubernetes-preserve-unknown-fields | object / "message type", unknown fields are NOT accessible in CEL expression |
509+
| x-kubernetes-int-or-string | dynamic object that is either an int or a string, `type(value)` can be used to check the type |
510+
| 'array | list |
511+
| 'array' with x-kubernetes-list-type=map | list with map based Equality & unique key guarantees |
512+
| 'array' with x-kubernetes-list-type=set | list with set based Equality & unique entry guarantees |
513+
| 'boolean' | boolean |
514+
| 'number' (all formats) | double |
515+
| 'integer' (all formats) | int (64) |
516+
| 'null' | null_type |
517+
| 'string' | string |
518+
| 'string' with format=byte (base64 encoded) | bytes |
519+
| 'string' with format=date | timestamp (google.protobuf.Timestamp) |
520+
| 'string' with format=datetime | timestamp (google.protobuf.Timestamp) |
521+
| 'string' with format=duration | duration (google.protobuf.Duration) |
526522

527523
xref: [CEL types](https://github.com/google/cel-spec/blob/master/doc/langdef.md#values), [OpenAPI
528524
types](https://swagger.io/specification/#data-types), [Kubernetes Structural Schemas](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema).
529525

530526
Although `x-kubernetes-preserve-unknown-fields` allows custom resources to contain values without
531-
corresponding schema information, we will not provide validation support of these "schemaless"
532-
values. Reasons for this include:
527+
corresponding schema information, we will not provide access to these "schemaless" values in CEL
528+
expressions. Reasons for this include:
533529

534530
- Without schema information, types (e.g. `map` vs. `object`), formats (e.g. plain `string`
535531
vs. `date`) and list types (plain `list` vs. `set`) are not available, and this feature depends

keps/sig-api-machinery/2876-crd-validation-expression-language/kep.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors:
66
- "@DangerOnTheRanger"
77
- "@leilajal"
88
owning-sig: sig-api-machinery
9-
status: implementable
9+
status: implemented
1010
creation-date: 2021-05-26
1111
reviewers:
1212
- "@deads2k"
@@ -16,6 +16,7 @@ reviewers:
1616
approvers:
1717
- "@deads2k"
1818
- "@lavalamp"
19+
- "@liggitt"
1920

2021
##### WARNING !!! ######
2122
# prr-approvers has been moved to its own location

0 commit comments

Comments
 (0)