-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Protobuf serialization does not distinguish between []
and null
#44593
Comments
nothing related to this changed between 1.6.0 and 1.6.1: |
the issue with null slices was supposed to be fixed by #43422, but I'm seeing different behavior between a list and an individual item. this issue exists in v1.6.0 as well. it only shows up when your etcd storage media type is |
xref #46733 |
copied from #45294 (comment):
|
[]
and null
/remove-kind support |
Automatic merge from submit-queue Remove null -> [] slice hack Closes #44593 When 1.6 added protobuf storage, the storage layer lost the ability to persist slice fields with empty but non-null values. As a workaround, we tried to convert empty slice fields to `[]`, rather than `null`. Compressing `null` -> `[]` was just as much of an API breakage as `[]` -> `null`, but was hoped to cause fewer problems in clients that don't do null checks. Because of conversion optimizations around converting lists of objects, the `null` -> `[]` hack was discovered to only apply to individual get requests, not to a list of objects. 1.6 and 1.7 was released with this behavior, and the world didn't explode. 1.7 documented the breaking API change that `null` and `[]` should be considered equivalent, unless otherwise noted on a particular field. This PR: * Reverts the earlier attempt (#43422) at ensuring non-null json slice output in conversion * Makes results of `get` consistent with the results of `list` (which helps naive clients that do deepequal comparisons of objects obtained via list/watch and get), and allows empty slice fields to be returned as `null` ```release-note Protobuf serialization does not distinguish between `[]` and `null`. API fields previously capable of storing and returning either `[]` and `null` via JSON API requests (for example, the Endpoints `subsets` field) can now store only `null` when created using the protobuf content-type or stored in etcd using protobuf serialization (the default in 1.6+). JSON API clients should tolerate `null` values for such fields, and treat `null` and `[]` as equivalent in meaning unless specifically documented otherwise for a particular field. ```
Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): Not a request for help. Observed undocumented change in 1.6.1 api.
What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): endpoints subsets api
Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT
Kubernetes version (use
kubectl version
):Environment:
uname -a
):1.6.1 alpha cluster set up with:
What happened:
Observed API change in 1.6.1.
api/v1/namespaces/{namespace}/endpoints
returnsnull
for.items[].subsets
. 1.6.0 returns[]
What you expected to happen:
Expect 1.6.1 to match 1.6.0, and return
[]
How to reproduce it (as minimally and precisely as possible):
1.6.0
1.6.1
Anything else we need to know:
Original bug reported as an exception in linkerd:
linkerd/linkerd#1219
The text was updated successfully, but these errors were encountered: