Model objects should tolerate None in place of empty lists
See original GitHub issuePython client version: 4.0.0a1 Server version: 1.8.0
On an endpoints request, Kubernetes 1.8 will return "subsets": null
in the case of an empty subsets list. This leads to an error on deserialization:
File "/usr/local/lib/python3.6/dist-packages/kubernetes/watch/watch.py", line 119, in stream yield self.unmarshal_event(line, return_type) File "/usr/local/lib/python3.6/dist-packages/kubernetes/watch/watch.py", line 83, in unmarshal_event
js['object'] = self._api_client.deserialize(obj, return_type) File "/usr/local/lib/python3.6/dist-packages/kubernetes/client/api_client.py", line 236, in deserialize return self.__deserialize(data, response_type)
File "/usr/local/lib/python3.6/dist-packages/kubernetes/client/api_client.py", line 276, in __deserialize
return self.__deserialize_model(data, klass)
File "/usr/local/lib/python3.6/dist-packages/kubernetes/client/api_client.py", line 622, in __deserialize_model
instance = klass(**kwargs)
File "/usr/local/lib/python3.6/dist-packages/kubernetes/client/models/v1_endpoints.py", line 64, in __init__
self.subsets = subsets
File "/usr/local/lib/python3.6/dist-packages/kubernetes/client/models/v1_endpoints.py", line 156, in subsets
raise ValueError("Invalid value for `subsets`, must not be `None`")
ValueError: Invalid value for `subsets`, must not be `None`
See related Kubernetes issue: https://github.com/kubernetes/kubernetes/issues/44593 However, that issue was eventually resolved by declaring that as clients should treat nulls and empty lists as interchangeable unless specified otherwise: https://github.com/kubernetes/kubernetes/pull/45294
The Python client should remove the none-checks, or possibly translate them to empty lists (though if they decided against that on the server-side, it sounds risky).
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:15 (4 by maintainers)
Top Results From Across the Web
How is memory allocated for empty list, tuple, dictionary?
I am new to python programming, as per OOps Concepts memory will allocated for every Object, in python programming, ...
Read more >google.appengine.ext.db package - Python 2
Static properties on Expando can still support empty lists but like normal Model properties is restricted from using None.
Read more >Taints and Tolerations | Kubernetes
There are two special cases: An empty key with operator Exists matches all keys, values and effects which means this will tolerate everything....
Read more >pandas.DataFrame.reindex_like — pandas 1.5.2 documentation
A new object is produced unless the new index is equivalent to the current one and ... or list-like, which applies variable tolerance...
Read more >ListView class - widgets library - Flutter - Dart API docs
A new child at the same position in the list will be lazily recreated along ... UI subtree be easily recreate-able from the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone looking for an easy workaround. You can easily monkey patch the class giving you errors:
Just to piggy back off this issue. I’m seeing a similar error with the
list_event_for_all_namespaces
endpoint."ValueError: Invalid value for involved_object, must not be None"
python client: 4.0.0 K8s API Version: 1.6.4
I did not see this issue when were using the 2.2.0 of the python client.