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
Fix serialization of x-kubernetes-validations OpenAPI extension #107970
Fix serialization of x-kubernetes-validations OpenAPI extension #107970
Conversation
@liggitt: GitHub didn't allow me to request PR reviews from the following users: benluddy. Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
serialization issue seen here:
|
This is producing an unserializable extension: kubernetes/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/validation.go Lines 257 to 259 in 9b09612
Because the referenced Options:
My instinct is to go with option 2 |
hmm... switching conversion entirely to use v1 schema types wreaks havoc with the handling of raw JSON values for defaults, etc |
d76b9f9
to
daaffb7
Compare
I defined an internal->v1 conversion for the ValidationRules type, and use the v1 type when constructing a structural schema |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt 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 |
daaffb7
to
6e250f1
Compare
/triage accepted |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/assign |
/lgtm |
@benluddy: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @jpbetz |
staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/conversion_test.go
Outdated
Show resolved
Hide resolved
6e250f1
to
5efe1e6
Compare
/retest |
/lgtm Wow, I'm surprised we didn't notice this till now. Thanks for fixing! |
…970-upstream-release-1.23 Automated cherry pick of #107970: Make JSON schema round tripping test more strict
What type of PR is this?
/kind bug
/kind flake
What this PR does / why we need it:
Switches the openapi serialized extension for
x-kubernetes-validations
to use the external type with correct json tags. It was getting serialized incorrectly as[{"Message":"...", "Rule":"..."}]
Makes the jsonschemaprops -> openapi -> jsonschemaprops roundtrip test more strict
/cc @benluddy @sttts
/sig api-machinery