-
Notifications
You must be signed in to change notification settings - Fork 39.2k
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
CustomResources dropping "null" values from arrays #98080
Comments
That's clearly a bug, thanks for the easy steps to reproduce, I'll look at it. |
This is about data loss. Set to urgent to investigate. |
Digging briefly, it looks at first glance like json-patch is dropping all null values in https://github.com/evanphx/json-patch/blob/master/merge.go#L81 (haven't verified with a test yet, just manual inspection) |
Based on Jordan's reading and mine, this is a bug/misreading of the JSON Merge patch. We should probably patch upstream. |
/triage accepted |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
The patch about preserving null values in the arrays was merged to the json-patch, so the issue should be fixed |
We probably need to update the version of json-patch used in kubernetes now! |
@pacoxu Yup, v5.5.0 has been released with the fixes. |
Currently, v4.5.0 cannot be removed for kustomize
I opened kubernetes-sigs/kustomize#3938 for kustomize. |
Update to v4.11.0 to fix it. |
What happened:
While attempting to work around #98079, I encountered an issue where data was not preserved when writing a custom resource instance to the apiserver with kubectl.
Specifically, I am using a CRD that has a properly which is an array of values which can either be an integer, or null:
When using kubectl to modify the resource, all of the "null" values are lost upon write. So, if I attempt to write a resource with the following:
It is written successfully. However, when I query the resource from the API afterwards, this is what I get back:
The null entries have been lost.
What you expected to happen:
The null entries in the array should be maintained.
How to reproduce it (as minimally and precisely as possible):
Create a CustomResourceDefinition with a property like the one specified above, and create an instance of it (you may need to pass
--validate=false
in order to bypass the bug in #98079).Notice that
null
values are removed from the array.Anything else we need to know?:
Environment:
kubectl version
):Also reproduced on master by @liggitt
CC @sttts @apelisse
/sig api-machinery
The text was updated successfully, but these errors were encountered: