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
Deeply copy JSONSchemaProps.XValidations. #107956
Conversation
Hi @benluddy. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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 |
/sig api-machinery |
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. |
/cc @sttts |
/ok-to-test |
/assign @liggitt |
huh... glad to see this fixed... is there a test that should be updated that would have noticed this deterministically in presubmit? |
trying to remember why these are hand-written and not generated |
The fuzzer seeds the global math/rand source from itself in https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/roundtrip.go#L63, so it probably depends on whatever else is using that source in-process. That should probably be seeded from a better source of randomness (maybe with an env var or flag to override the seed for reproducibility?). Edit: I'm not aware of a deterministic test, but it seems this would have shown up all the time as a flake if the fuzzer were seeded better. I ran this test with 10000 seeds and it caught the bug around 75% of the time. |
/test pull-kubernetes-node-e2e-containerd |
/lgtm mind picking to release-1.23 once this merges? |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: benluddy, 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 |
Did you remember? Is it because of the |
…7956-upstream-release-1.23 Automated cherry pick of #107956: Deeply copy JSONSchemaProps.XValidations.
yeah, attempting to autogenerate:
|
looks like we can narrowly define DeepCopy for JSON and take advantage of generated deep copy code for the rest |
actually... defining that makes the generated deep copy files/functions look right, but go is unhappy with defining DeepCopy methods on JSON:
|
/triage accepted |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Mutations to XValidations in a deep-copied CRD's schema can alter the original.
Which issue(s) this PR fixes:
Fixes #107954
Does this PR introduce a user-facing change?