• Kubernetes Submit Queue's avatar
    Merge pull request #45294 from liggitt/proto-slices · 217513e2
    Kubernetes Submit Queue authored
    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 (https://github.com/kubernetes/kubernetes/pull/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.
    ```
    217513e2
Name
Last commit
Last update
..
endpoints Loading commit data...
events Loading commit data...
fuzzer Loading commit data...
helper Loading commit data...
install Loading commit data...
persistentvolume Loading commit data...
pod Loading commit data...
ref Loading commit data...
resource Loading commit data...
service Loading commit data...
testapi Loading commit data...
testing Loading commit data...
unversioned Loading commit data...
util Loading commit data...
v1 Loading commit data...
validation Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...
annotation_key_constants.go Loading commit data...
conversion_test.go Loading commit data...
copy_test.go Loading commit data...
deep_copy_test.go Loading commit data...
defaulting_test.go Loading commit data...
doc.go Loading commit data...
field_constants.go Loading commit data...
json.go Loading commit data...
meta_test.go Loading commit data...
node_example.json Loading commit data...
objectreference.go Loading commit data...
register.go Loading commit data...
replication_controller_example.json Loading commit data...
resource.go Loading commit data...
serialization_proto_test.go Loading commit data...
serialization_test.go Loading commit data...
taint.go Loading commit data...
taint_test.go Loading commit data...
toleration.go Loading commit data...
types.go Loading commit data...
unstructured_test.go Loading commit data...
zz_generated.deepcopy.go Loading commit data...