-
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
base: master
Are you sure you want to change the base?
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
|
||
``` | ||
* They operate on the same underlying storage object as the primary resource (i.e., same `kind`, same object in etcd). | ||
* Updates via these subresources are typically scoped to specific fields within the object. Changes to field values not in scope are tyipcally reset, or "wiped", before 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.
* Updates via these subresources are typically scoped to specific fields within the object. Changes to field values not in scope are tyipcally reset, or "wiped", before validation. | |
* Updates via these subresources are typically scoped to specific fields within the object. Changes to field values not in scope are typically reset, or "wiped", before validation. |
**Support required:** | ||
|
||
* Declarative validation will need to provide a easy way for a storage layer to map the internal type of a subresource to the | ||
requested versioned type of that resource. For primary resoruce validation, the information is present in the requestInfo of |
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.
requested versioned type of that resource. For primary resoruce validation, the information is present in the requestInfo of | |
requested versioned type of that resource. For primary resource validation, the information is present in the requestInfo of |
1. **Field Wiping (Pre-Validation):** Declarative Validation *does not* scope which fields a subresource operation can write. Instead, this responsibility lies with the resource's strategy implementation. The strategy modifies the incoming object *before* validation, "wiping" or resetting any fields the specific subresource operation is not allowed to change. Once wiped, the ratcheting mechanism (below) will skip validation of these fields, since wiping ensures that they are unchanged. | ||
2. **Full Resource Validation:** The *entire*, modified resource object is validated against the primary resource's versioned type. That is, *same* set of declarative validation rules applied to the primary resource and to status-type subresources. | ||
3. **Conditional Validation:** Validation rules can use a special `subresource` parameter (e.g., `subresource == '/status'`) to apply conditional logic. This allows rules to behave differently depending on whether the update comes via the primary resource or a specific subresource. | ||
4. **Ratcheting:** Declarative Validation uses ratcheting, meaning it skips validation checks on fields that have not changed from the existing stored object. Combined with field wiping, this scopes validation to only the subset of fields that the subresource operation is intended and permitted to modify. |
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.
Should we state it as "ignore the validation error if the field unchanged"? Because we haven't decided whether to skip validating when unchanged or validate then ignore the error if fields unchanged.
"The errors from the unchanged fields would be ignored" seems more accurate?
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.