-
Notifications
You must be signed in to change notification settings - Fork 1.5k
KEP-5073: Declarative Validation: Explain subresources #5244
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
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jpbetz 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 |
89be28f
to
b2348a4
Compare
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Yongrui Lin <[email protected]>
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.
Can we get some more detail on conditional validation will be structured and if/how validation conditional on the content of request is separated from conditional validation based on the REST endpoint accessed?
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Show resolved
Hide resolved
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
TODO: Document and explain how: | ||
|
||
- Add general purpose ratcheting to automatically skip validation of unchanged fields | ||
- Catalog and handle complex cases where strict equality checks are not sufficient (lots of non-trivial cases exist today) |
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 think this is important to describe. Particular the limits on conditional validation.
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.
Yes, we hope to have the plan for this out for review this week. I'm fine holding the merge of this PR until that plan has been reviewed and we're all comfortable with how the features interact.
|
||
**Support required:** | ||
|
||
* Conditional validation, provided by dedicated `+k8s:subresource` and `+k8s:exceptSubresource` tags and a `subresources` parameter within validation rule expressions (e.g. `+k8s:if('subresource != "/resize"')=+k8s:immutable`). |
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.
minor point, but we should land on a convention for names. We have ifOption
and ifNotOption
in dev branch. Cross-field is looking at if
, so ifNot
makes sense, but we need to think about how to handle "else" without re-evaluating the expression.
So should this be ifSubresource
and ifNotSubresource
?
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'm OK with "if" and "ifNot". @deads2k?
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'm OK with "if" and "ifNot". @deads2k?
I like the update
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
keps/sig-api-machinery/5073-declarative-validation-with-validation-gen/README.md
Outdated
Show resolved
Hide resolved
|
||
**Validation Process:** | ||
|
||
1. **Subresource Validation:** The incoming subresource object itself (e.g., the `autoscaling/v1.Scale` object) is validated using *its own* declarative rules. |
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.
To have declarative validation used for the subresource object validation, all the endpoints must agree on the validation. I think this is a good thing and I think we obey this today, but it is notable.
/lgtm holding both in case @thockin needs a second look and because I'd like the ratcheting update merged before adding a design that says we're going to rely upon it. Assuming ratcheting looks good, I like this. |
@thockin any concerns with this before it merges? |
This addresses how we intend to handle subresources with Declarative Validation.
A separate PR will update the ratcheting section to address the need to skip unchanged fields when validating.