Cannot run tests with Python 3.10
obrienrobert opened this issue · comments
When running Krkn with python 3.10, the following error occurs:
2022-05-27 11:18:16,924 [INFO] Starting kraken
2022-05-27 11:18:16,933 [INFO] Initializing client to talk to the Kubernetes cluster
Traceback (most recent call last):
File "/home/robrien/repos/krkn/run_kraken.py", line 310, in <module>
main(options.cfg)
File "/home/robrien/repos/krkn/run_kraken.py", line 81, in main
kubecli.find_kraken_node()
File "/home/robrien/repos/krkn/kraken/kubernetes/client.py", line 406, in find_kraken_node
pods = get_all_pods()
File "/home/robrien/repos/krkn/kraken/kubernetes/client.py", line 175, in get_all_pods
ret = cli.list_pod_for_all_namespaces(pretty=True)
File "/home/robrien/.local/lib/python3.10/site-packages/kubernetes/client/api/core_v1_api.py", line 16864, in list_pod_for_all_namespaces
return self.list_pod_for_all_namespaces_with_http_info(**kwargs) # noqa: E501
File "/home/robrien/.local/lib/python3.10/site-packages/kubernetes/client/api/core_v1_api.py", line 16967, in list_pod_for_all_namespaces_with_http_info
return self.api_client.call_api(
File "/home/robrien/.local/lib/python3.10/site-packages/kubernetes/client/api_client.py", line 348, in call_api
...
AttributeError: module 'collections' has no attribute 'Callable'
The error doesn't occur when using Python 3.8. It looks to be caused by the Kubernetes Python Client version: 18.20.0
. If we try to use the latest Kubernetes version (v23.6.0
), we get the following error:
ERROR: Cannot install -r requirements.txt (line 4) and kubernetes==23.6.0 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested kubernetes==23.6.0
powerfulseal 3.3.0 depends on kubernetes==18.20.0
This can be tested with the following minimal working example code snippet (once logged into a cluster):
import kubernetes
def test():
kubernetes.config.load_kube_config()
v1 = kubernetes.client.CoreV1Api()
v1.list_pod_for_all_namespaces(pretty=True)
if __name__ == "__main__":
test()
Hi @obrienrobert, thanks for reporting the issue!
About using the latest Kubernetes version (v23.6.0), we are in the process to trying to get the kubernetes client version in powerfulseal bumped up: powerfulseal/powerfulseal#358 before doing the same in Kraken.
We will take a look at fixing the code to work with python 3.10 while being backward compatible. Will keep you updated. Thanks.
Issues should be fixed and Kraken is supported with python 3.10. Please feel free to re-open if there are any issues. Thanks.