-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
KEP-5073: Declarative Validation of Kubernetes Native Types With validation-gen #5074
base: master
Are you sure you want to change the base?
KEP-5073: Declarative Validation of Kubernetes Native Types With validation-gen #5074
Conversation
73f9dcd
to
fdcec1b
Compare
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/kep.yaml
Show resolved
Hide resolved
/label lead-opted-in |
996751a
to
b31c75f
Compare
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
b31c75f
to
c1bce5a
Compare
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Show resolved
Hide resolved
ab4fe70
to
68fe8c5
Compare
I haven't looked in detail at the specifics but this is great direction to go! |
115aabe
to
1d7e6e6
Compare
1d7e6e6
to
abd9ff7
Compare
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
…idation-gen_yongrlin update KEP-5073 to clarify migration details
051733d
to
07f5524
Compare
|
||
#### `validation-gen` Has No Plans To Use CEL Validation Directly | ||
|
||
The previous Declarative Validation proposal ([KEP-4153](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/4153-declarative-validation)) proposed using CEL for a number of the complex validations present in the current Kubernetes validation logic for native types (cross-field, transition, etc.). The `validation-gen` solution presented here uses go code directly for the validations which means we do not plan on evaluating CEL server side as we can write arbitrary go code to perform server side validations. This allows the `validation-gen` solution to be highly flexible and performant. If we reach a point where CEL makes sense, we can evaluate it at that time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing something here, but if an eventual goal is to make this available for CRDs, it seems like the move away from CEL would complicate that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can get to a place where you don't even need CEL for most validation, and the code that was invoked was LITERALLY the same code as is run for built-in types, that sounds pretty good, no?
Also, and I know it's not for you, but imagine you could specifically say "and then invoke the pod validation logic" without inlining it all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing something here, but if an eventual goal is to make this available for CRDs
I see this project largely as build-in types catching up with what CRDs already have-- a way to declare validation directly in the schema. In the case of CRDs this is via OpenAPI and x-kubernetes-*
extensions. In the case of built-ins, it's via // +
tags.
The benefit to CRDs will be a follow on as move toward parity. The two at top of mind for me are:
- CRDs become able to compose-in built-in types while retaining validation fidelity. The approach today of copy-pasting OpenAPI from built-in types into CRD schemas is extremely lossy.
- As we bring built-ins to parity with CRDs, we add capabilities to CRDs to bring the systems into alignment. I expect that to include a mix of new OpenAPI capabilities and CEL capabilities on the CRD side.
* Ability to give users direct access to the actual API validation rules (via publishing OpenAPI rules for native types), which are currently only available to developers willing and able to find and read the hand written validation rules. | ||
* Ability to enable clients to perform validation of native types earlier in development workflows ("shift-left"), such as with a Git pre-submit linter. | ||
* Ability to improve API composition. In particular CRDs that embed native types (such as PodTemplate), which gain validation of the native type automatically. This has the potential to simplify controller development and improve end user experiences when using CRDs. | ||
* (Eventually) bring CRD validation and built-in validation together with the same set of server-side validations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be wrong on this, but I thought there was an overall architectural goal to push a large portion of new API development out of k/k and into CRDs. If I'm understanding that correctly, why aren't CRDs an immediate goal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most immediate goal is to lessen the burden and risk of hand-written validation code and to simultaneously lay pavement for CRDs to call the same code, with ~0 perf hit.
KEP-5073: Runtime verification testing
3f616dd
to
432fe22
Compare
fa57b1f
to
cacfe64
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aaron-prindle, jpbetz, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Do we feel like this is converging enough to merge and iterate? Basically, in or out for 33? |
cacfe64
to
65f989d
Compare
|
||
## Future Work | ||
### "New K8s Native APIs" Design Partner For Declarative Validation in 1.34 | ||
For 1.34 the Declarative Validation working group is looking for a design partner to collaborate with aid in the UX, "validator" creation, and developer process of using Declarative Validation. The partnership would be focused around the new k8s native API creation context of declarative validation (vs the migrating of current k8s native APIs). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spoke offline w/ @thockin and @jpbetz regarding the idea of having a design partner for Declarative Validation specifically circle the 1.34 release timeline around the users story of "new k8s API creation".
@pohly - would DRA be interested in pursuing being a design partner for Declarative Validation? (re: from discussion in #5034)
Happy to discuss more here if so or via slack, etc. Thanks
One-line PR description: Implement declarative validation of Kubernetes native types using
validation-gen
to generate validation code.Issue link: #5073