kubernetes-client / kubernetes-client/python

Unable to deserialize models with attributes of type RuntimeRawExtension

未關閉
#461 16 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
lifecycle/frozen
主要語言
Python
星號
7.7k
分支
3.5k
平均合併
1 天 14 小時
30 天內合併 PR
18

描述

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.

貢獻指南

開啟貢獻指南

研究方向

從 kubernetes/client/api_client.py 第 617 行附近開始,在一個運作中的 Kubernetes 叢集和可正常工作的 kubeconfig 上重現 ControllerRevision 範例。追蹤自由格式 JSON 反序列化為 RuntimeRawExtension 的過程;當產生的模型保留原始值,而不是在沒有該值的情況下初始化時,就會執行此過程。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
api
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。