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

Skip to content

pod condition_type values are not consistent with actual possible values of kubernetes #1760

Closed as not planned
@DanArlowski

Description

@DanArlowski

What happened (please include outputs or screenshots):
when trying to fetch pods (namespaced, cluster wide, or a single pod),
when the pod status is not ['ContainersReady', 'Initialized', 'PodScheduled', 'Ready']
an exceptions is raised:

Traceback (most recent call last):
    pod_list = self.core_v1.list_namespaced_pod(namespace)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 15697, in list_namespaced_pod
    return self.list_namespaced_pod_with_http_info(namespace, **kwargs)  # noqa: E501
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 15812, in list_namespaced_pod_with_http_info
    return self.api_client.call_api(
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 192, in __call_api
    return_data = self.deserialize(response_data, response_type)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 264, in deserialize
    return self.__deserialize(data, response_type)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 303, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 639, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 280, in __deserialize
    return [self.__deserialize(sub_data, sub_kls)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 280, in <listcomp>
    return [self.__deserialize(sub_data, sub_kls)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 303, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 639, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 303, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 639, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 280, in __deserialize
    return [self.__deserialize(sub_data, sub_kls)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 280, in <listcomp>
    return [self.__deserialize(sub_data, sub_kls)
  File "/home/dan/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 303, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 641, in __deserialize_model
    instance = klass(**kwargs)
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/models/v1_pod_readiness_gate.py", line 52, in __init__
    self.condition_type = condition_type
  File "/home/.cache/pypoetry/virtualenvs/sosivio3-l1HFUjLL-py3.9/lib/python3.9/site-packages/kubernetes/client/models/v1_pod_readiness_gate.py", line 78, in condition_type
    raise ValueError(
ValueError: Invalid value for `condition_type` (www.dmlhgrdtdhzerjqa.com), must be one of ['ContainersReady', 'Initialized', 'PodScheduled', 'Ready']

What you expected to happen:
The running pods in the namespace have the following Statuses:
Terminating Running Pending ImagePullBackOff ErrImageNeverPull ErrImageNeverPull ErrImageNeverPull
(this is the kubectl get pods status)

How to reproduce it (as minimally and precisely as possible):
try to get pods in namespace with a non-straightforward status.

Anything else we need to know?:
I think the Problem is that the possible enum values does not align with the actual values that are possible in kube.

Environment:

  • Kubernetes version (kubectl version): 1.23
$ oc version                                          
Client Version: 4.8.11
Server Version: 4.7.34
Kubernetes Version: v1.20.0+bbbc079
  • OS (e.g., MacOS 10.13.6): ubuntu 20.04
  • Python version (python --version) 3.9.2
  • Python client version (pip list | grep kubernetes) 23.3.0

Metadata

Metadata

Assignees

No one assigned

    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