Skip to content

Commit fa57b1f

Browse files
committed
resolving KEP comments round kubernetes#4
1 parent dfd2951 commit fa57b1f

File tree

1 file changed

+10
-4
lines changed
  • keps/sig-api-machinery/5073-declarative-validation-with-validation-gen

1 file changed

+10
-4
lines changed

keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,11 @@ Today, the apiserver's request handler decodes incoming versioned API requests t
374374

375375
Assuming we use the recommended plan of declarative validation operating on versioned types, the internal type will no longer be responsible for validation.
376376

377-
If we were to convert from the internal back to the version of the API request for validation, we would introduce one additional conversion. If we make this an "unsafe" conversion, then it will be low cost for the vast majority of requests.
377+
We will convert from the internal back to the version of the API request for validation introducing one additional conversion. If we make this an "unsafe" conversion, then it will be low cost for the vast majority of requests.
378378

379379
We will benchmark this approach and plan to use it for beta.
380380

381-
Long term, we could do better:
381+
**NOTE**: Long term, it is possible that we could make one of versioned types be the hub type:
382382

383383
Since the internal type will no longer be used for validation, it becomes a lot less important. It is still important to have a hub type. But why not pick one of the versioned types to be the hub type? The vast majority of APIs only have one version anyway. The obvious candidate version to choose for the hub version would be the preferred storage version.
384384

@@ -388,11 +388,17 @@ Switching to a versioned type for the hub type would have a few implications:
388388
* We would introduce more conversion when API request version differs from the hub version. But beta APIs are off-by-default and we expect a lot less mixed version API usage than in the past.
389389
* Would require rewriting in tree admission plugins.
390390

391-
This "hub version" change feels like something that could be made somewhat independent of this KEP.
391+
This "hub version" change is something that could be made independent of this KEP, just noting the idea here.
392+
393+
##### Mitigation: Resolve Known "Low Hanging Fruit" of Performance Improvements In Current Validation Code
394+
395+
From analyzing the validation code there is "SO MUCH low-hanging fruit" - @thockin with respect to performance improvements. As such it is likely Declarative Validation can cover any perf deficit by improving validation performance generally. One example of this that already came up is related to the algorithm used for `listmap` (see prototype for more information)
392396

393397
##### Mitigation: Avoid Conversion to Internal Type
394398

395-
Requests are received as the versioned type, so it should be feasible to avoid extra conversions for resources that have no need of handwritten validations.
399+
**NOTE** This would be a SIGNIFICANT undertaking to prove defaulting and admission is equivalent.
400+
401+
Requests are received as the versioned type, so it should be feasible to avoid extra conversions for resources that have no need of handwritten validations. This is likely not necessary given the known "low hanging fruit" of performance improvements but mentioned for completeness.
396402

397403
## Design Details
398404

0 commit comments

Comments
 (0)