Thanks to visit codestin.com
Credit goes to github.com

Skip to content

client.read_namespaced_pod does not work via pod is created by CRD resource #1744

Closed as not planned
@Huanxin-leolil

Description

@Huanxin-leolil

What happened (please include outputs or screenshots):
When I run the following script:

api_client = client.ApiClient(config.load_kube_config(config_path), pool_threads=1)
k8s_client = client.CoreV1Api(api_client)
k8s_resp = k8s_client.read_namespaced_pod(name="ists-1", namespace="qa-test")
print (str(k8s_resp))

I got error:

  File "run.py", line 19, in <module>
    main()
  File "run.py", line 15, in main
    k8s_resp = k8s_client.read_namespaced_pod(name="ists-0", namespace="qa-test")
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api/core_v1_api.py", line 23483, in read_namespaced_pod
    return self.read_namespaced_pod_with_http_info(name, namespace, **kwargs)  # noqa: E501
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api/core_v1_api.py", line 23584, in read_namespaced_pod_with_http_info
    collection_formats=collection_formats)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 353, in call_api
    _preload_content, _request_timeout, _host)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 192, in __call_api
    return_data = self.deserialize(response_data, response_type)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 264, in deserialize
    return self.__deserialize(data, response_type)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 303, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 639, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 303, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 639, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 281, in __deserialize
    for sub_data in data]
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 281, in <listcomp>
    for sub_data in data]
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 303, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 641, in __deserialize_model
    instance = klass(**kwargs)
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/models/v1_pod_readiness_gate.py", line 52, in __init__
    self.condition_type = condition_type
  File "/home/users/venv/lib/python3.6/site-packages/kubernetes/client/models/v1_pod_readiness_gate.py", line 80, in condition_type
    .format(condition_type, allowed_values)
ValueError: Invalid value for `condition_type` (InPlaceUpdateReady), must be one of ['ContainersReady', 'Initialized', 'PodScheduled', 'Ready']

What you expected to happen:
I expect show the pod.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:
my pod is created by CRD resource, so InPlaceUpdateReady status is custom properties.

Environment:

  • Kubernetes version (kubectl version):
  • OS (e.g., MacOS 10.13.6):
  • Python version (python --version)
    Python 3.6.4
  • Python client version (pip list | grep kubernetes)
    kubernetes 23.3.0

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions