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

✨ Add FieldPath and Reason to XValidation marker #932

Merged
merged 1 commit into from Apr 24, 2024

Conversation

JoelSpeed
Copy link
Contributor

This allows you to specify the FieldPath and Reason on an XValidation rule. These can be useful when you are specifying validations that look at multiple fields or if the default reason of Invalid doesn't suit.

One use case would be a field that you no longer want set. You can add a CEL validation to make sure no one adds it to the object going forward. For this you would want the Forbidden reason, but the rule needs to be on the parent, which means you then need to use the field path to construct the correct error message path.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 23, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 23, 2024
@JoelSpeed
Copy link
Contributor Author

/hold testing the output of this to make sure it does what I expect

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 23, 2024
@JoelSpeed
Copy link
Contributor Author

/hold cancel

Yep, this is working as intended and I've tested the fieldPath and reason fields separately on a 1.29 KAS

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 24, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 24, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed, vincepri

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 Apr 24, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: cef6c895428289da62c4fd93f6ffc54981209bea

@k8s-ci-robot k8s-ci-robot merged commit e535678 into kubernetes-sigs:master Apr 24, 2024
7 checks passed
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

None yet

3 participants