kubernetes-client / kubernetes-client/python
Unable to deserialize models with attributes of type RuntimeRawExtension
- Dominant language
- Python
- Stars
- 7.7k
- Forks
- 3.5k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 18
Description
Minimal example for ControllerRevision (requires an active kubernetes cluster with working kubeconfig):
```python
from kubernetes import client, config
config.load_kube_config()
apps_v1beta1_api = client.AppsV1beta1Api()
controller_revisions = apps_v1beta1_api.list_controller_revision_for_all_namespaces()
```
Issue seems to be here: https://github.com/kubernetes-client/python/blob/master/kubernetes/client/api_client.py#L617
```python
if data is not None \
and klass.attribute_map[attr] in data \ # <-- here
and isinstance(data, (list, dict)):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)
```
where it is looking for the `'Raw'` attribute in `data`, but `data` is a freeform JSON object with no specific `'Raw'` key. Because this conditional fails, nothing is ever added to kwargs, and `RuntimeRawExtension` is initialized without the required `raw` value.
Contributor guide
Research direction
Start in kubernetes/client/api_client.py around line 617 and reproduce the ControllerRevision example with an active Kubernetes cluster and working kubeconfig. Trace deserialization of the freeform JSON into RuntimeRawExtension; it is done when the resulting model preserves the raw value instead of initializing without it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100