Skip to content
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

Update doc for KEP 2876 #42120

Merged
merged 3 commits into from
Aug 1, 2023
Merged

Update doc for KEP 2876 #42120

merged 3 commits into from
Aug 1, 2023

Conversation

cici37
Copy link
Contributor

@cici37 cici37 commented Jul 20, 2023

No description provided.

@k8s-ci-robot k8s-ci-robot added this to the 1.28 milestone Jul 20, 2023
@netlify
Copy link

netlify bot commented Jul 20, 2023

👷 Deploy Preview for kubernetes-io-vnext-staging processing.

Name Link
🔨 Latest commit 61d5b61
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-vnext-staging/deploys/64bf469e545eb1000802d1af

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 20, 2023
@k8s-ci-robot k8s-ci-robot requested review from roycaihw and sttts July 20, 2023 23:16
@k8s-ci-robot k8s-ci-robot added language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 20, 2023
@cici37
Copy link
Contributor Author

cici37 commented Jul 20, 2023

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jul 20, 2023
@cici37
Copy link
Contributor Author

cici37 commented Jul 20, 2023

/assign @jpbetz
for tech review. Thank you!

Copy link
Member

@windsonsea windsonsea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some text suggestions

@cici37
Copy link
Contributor Author

cici37 commented Jul 21, 2023

@windsonsea All comments have been addressed. Thank you

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

I have a few suggestions, and also I'd like to know why setting fieldPath benefits people who consume the API that the CRD defines.

Comment on lines 1069 to 1074
#### The reason and fieldPath fields

Besides the `message` and `messageExpression` fields, which defines the string reported for a validation rule failure,
we have also added two more fields under `validation`:
- `reason` field which allows user to specify a machine-readable validation failure reason when a request fails this validation rule.
- `fieldPath` field which specify the field path returned when the validation fails.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We like timeless documentation: please avoid “we have also added”.

Suggested change
#### The reason and fieldPath fields
Besides the `message` and `messageExpression` fields, which defines the string reported for a validation rule failure,
we have also added two more fields under `validation`:
- `reason` field which allows user to specify a machine-readable validation failure reason when a request fails this validation rule.
- `fieldPath` field which specify the field path returned when the validation fails.
Setting `messageExpression` is optional.
#### The `message` field {#field-message}
If you want to set a static message, you can supply `message` rather than `messageExpression`.
The value of `message` is used as an opaque error string if validation fails.
Setting `message` is optional.
#### The `reason` field {#field-reason}
You can add a machine-readable validation failure reason within a `validation`, to be returned
whenever a request fails this validation rule.
<!-- an example here would be nice, but is hard to add using GitHub suggestions -->
Setting `reason` is optional.
#### The `fieldPath` field {#field-field-path}
You can specify the path to the data that have failed to validate.

NB. Can we explain why it's useful to specify a fieldPath?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review! I have updated the doc to align with the suggested format.
For fieldPath, we wanna user to be able to specify the accurate path when err returned instead of always using the path which self scoped. It is very usefully especially when do cross fields validation and user wanna the returned err indicate the path the err occurred. For example, if user trying to say a field has to be a different value than another field, something like self.foo.test.a != self.b. The validation has to be scoped high enough to have access to both field a and b but we wanna the returned err path to be on a, in this case having a fieldPath .foo.test.a will be great.
Hope that would make sense to you. Thank you^^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: I have also added explain in the doc with the example. Thank you

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 25, 2023
@jpbetz
Copy link
Contributor

jpbetz commented Jul 25, 2023

/approve
For technical content. This all looks accurate to me. Thanks @cici37

@jpbetz
Copy link
Contributor

jpbetz commented Jul 25, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 25, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: b052a7422411ba0ecde37f95cb38283d837143ba

@cici37
Copy link
Contributor Author

cici37 commented Jul 25, 2023

@sftim The PR has done with technical review and all comments have been addressed. It is ready for doc approval. Thank you!

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jpbetz, sftim

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 1, 2023
@k8s-ci-robot k8s-ci-robot merged commit 9ffbb3e into kubernetes:dev-1.28 Aug 1, 2023
Rishit-dagli pushed a commit to Rishit-dagli/website that referenced this pull request Aug 12, 2023
@cici37 cici37 deleted the 2876 branch August 14, 2023 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants