Skip to content

Commit c34654b

Browse files
committed
Fix formatting, add note about test utilities for 3rd party developers
1 parent fb94bdd commit c34654b

File tree

1 file changed

+16
-14
lines changed
  • keps/sig-api-machinery/2876-crd-validation-expression-language

1 file changed

+16
-14
lines changed

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

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,16 @@ like the `all` macro, e.g. `property.all(listItem, <predicate>)` or `property.al
253253
will be accessible to CEL via the `old<propertyName>` identifier.
254254
- This will only be available on mergable collection types such as objects (unless
255255
`x-kubernetes-map-type=atomic`), maps with `x-kubernetes-map-type=granular` and lists
256-
with `x-kubernetes-list-type` set to `set` or `map`. See (Merge
257-
Strategy)[https://kubernetes.io/docs/reference/using-api/server-side-apply/#merge-strategy] for
256+
with `x-kubernetes-list-type` set to `set` or `map`. See [Merge
257+
Strategy](https://kubernetes.io/docs/reference/using-api/server-side-apply/#merge-strategy) for
258258
details.
259259
- The use of "old" is congruent with how `AdmissionReview` identifies the existing object as
260260
`oldObject`. To avoid name collisions `old<propertyName>` will be treated the same as a CEL
261261
keyword for escaping purposes (see below).
262-
- xref (analysis of possible interactions with immutability and
263-
validation)[https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1101-immutable-fields#openapi-extension-x-kubernetes-immutable].
262+
- xref [analysis of possible interactions with immutability and
263+
validation](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1101-immutable-fields#openapi-extension-x-kubernetes-immutable).
264264

265-
- If a object property collides with a CEL keyword (see RESERVED in (CEL Syntax)[https://github.com/google/cel-spec/blob/master/doc/langdef.md#syntax]),
265+
- If a object property collides with a CEL keyword (see RESERVED in [CEL Syntax](https://github.com/google/cel-spec/blob/master/doc/langdef.md#syntax)),
266266
it will be escaped by prepending a _ prefix. To prevent this from causing a subsequent collision, all properties with a `_` prefix will always be
267267
prefixed by `__` (generally, N+1 the existing number of `_`s).
268268

@@ -274,7 +274,7 @@ like the `all` macro, e.g. `property.all(listItem, <predicate>)` or `property.al
274274
(Request Timeout) HTTP status code. The timeout will be a backstop we expect to rarely be used
275275
since CEL evaluations are multiple orders of magnitude faster that typical webhook invocations,
276276
and we can use CEL expression complexity estimations
277-
((xref)[https://github.com/jinmmin/cel-go/blob/a661c99f8e27676c70fc00f4f328476ca4dcdb7f/cel/program.go#L265])
277+
([xref](https://github.com/jinmmin/cel-go/blob/a661c99f8e27676c70fc00f4f328476ca4dcdb7f/cel/program.go#L265))
278278
during CRD update to bound complexity.
279279

280280
#### Field paths and field patterns
@@ -320,8 +320,7 @@ Considerations:
320320
### User Stories
321321

322322
- Cases provided by @deads2k
323-
- list of type foo struct {name string ... }, no item in the list can have a name == "value X", [ref](https://github.com/openshift/kubernetes/blob/75ee3073266
324-
f07baaba5db004cde0636425737cf/openshift-kube-apiserver/admission/customresourcevalidation/apiserver/validate_apiserver.go#L68).
323+
- list of type foo struct {name string ... }, no item in the list can have a name == "value X", [ref](https://github.com/openshift/kubernetes/blob/75ee3073266f07baaba5db004cde0636425737cf/openshift-kube-apiserver/admission/customresourcevalidation/apiserver/validate_apiserver.go#L68).
325324
- metadata.name must equal "valueX", [ref](https://github.com/openshift/kubernetes/blob/75ee3073266f07baaba5db004cde0636425737cf/openshift-kube-apiserver/admission/customresourcevalidation/apiserver/validate_apiserver.go#L47)
326325
- if name == "foo", then fieldX must not be nil, [ref](https://github.com/openshift/kubernetes/blob/75ee3073266f07baaba5db004cde0636425737cf/openshift-kube-apiserver/admission/customresourcevalidation/apiserver/validate_apiserver.go#L177)
327326
- if name == "foo", then field X must be nil, [ref](https://github.com/openshift/kubernetes/blob/75ee3073266f07baaba5db004cde0636425737cf/openshift-kube-apiserver/admission/customresourcevalidation/apiserver/validate_apiserver.go#L177)
@@ -356,8 +355,8 @@ the memory utilization. We will run a series of performance benchmarks with CEL
356355
utilize a range of CPU and memory resources and document the results of the benchmarks before
357356
promoting this feature to GA.
358357

359-
Also we can use (CEL complexity
360-
estimations)[https://github.com/jinmmin/cel-go/blob/a661c99f8e27676c70fc00f4f328476ca4dcdb7f/cel/program.go#L265]
358+
Also we can use [CEL complexity
359+
estimations](https://github.com/jinmmin/cel-go/blob/a661c99f8e27676c70fc00f4f328476ca4dcdb7f/cel/program.go#L265)
361360
to help bound running time.
362361

363362
#### Malicious use
@@ -368,8 +367,8 @@ Mitigation: CEL is designed to sandbox code execution. Also, because CRD creatio
368367
operation, it should be safe to integrate.
369368

370369
Additional limits we can put in place, as needed, include:
371-
- Use (CEL complexity
372-
estimations)[https://github.com/jinmmin/cel-go/blob/a661c99f8e27676c70fc00f4f328476ca4dcdb7f/cel/program.go#L265]
370+
- Use [CEL complexity
371+
estimations](https://github.com/jinmmin/cel-go/blob/a661c99f8e27676c70fc00f4f328476ca4dcdb7f/cel/program.go#L265)
373372
to bound running time.
374373
- A max execution time limit to but could bound running time of CEL programs. This would require
375374
modifying CEL (by working with the CEL community) to make CEL evaluation cancelable. Ideally this
@@ -400,7 +399,7 @@ in CRDs is sufficiently valuable due to its convenience that it should exist as
400399
believe CRD validation expressions can be kept congruent with general admission control CEL support.
401400

402401
(Thanks @liggitt for idea of using CEL for general admission control. This section is largely
403-
a copy-paste of (this comment)[https://github.com/kubernetes/enhancements/pull/2877#discussion_r704513565]).
402+
a copy-paste of [this comment](https://github.com/kubernetes/enhancements/pull/2877#discussion_r704513565)).
404403

405404
#### CEL Custom Resource Definition Conversion
406405

@@ -437,7 +436,7 @@ The good news is that https://github.com/google/cel-policy-templates-go already
437436
demonstrated integrating CEL with OpenAPIv3. We plan to leverage this work.
438437

439438
We will add detailed test coverage for numeric comparisons due to
440-
(google/cel-spec#54)[https://github.com/google/cel-spec/issues/54#issuecomment-491464172] including
439+
[google/cel-spec#54](https://github.com/google/cel-spec/issues/54#issuecomment-491464172) including
441440
coverage of interactions in these dimensions:
442441

443442
- schemas defining integer and number fields
@@ -450,6 +449,9 @@ coverage of interactions in these dimensions:
450449

451450
We will extend both the unit test suite and the integration test suite to cover the CRD validation rule described in this KEP.
452451

452+
We also intend to explore what testing utilities could be added to make it easier for 3rd party
453+
developers to test their validation rules.
454+
453455
### Graduation Criteria
454456

455457
#### Alpha

0 commit comments

Comments
 (0)