kubernetes-client / python

Official Python client library for kubernetes
http://kubernetes.io/
Apache License 2.0
6.55k stars 3.24k forks source link

kubernetes.client.Configuration.set_default is not working as expected #2202

Open DARSHAN-THE-CODER opened 4 months ago

DARSHAN-THE-CODER commented 4 months ago

What happened (please include outputs or screenshots): configuraa = client.Configuration() configuraa.retries = 1 client.Configuration.set_default(configuraa) Here, I am trying to override retries value from 3 to 1. This is from the source code ->

Screenshot 2024-03-01 at 12 30 58 AM

But I found that , you are not receiving that parameter here ->

Screenshot 2024-03-01 at 12 32 19 AM

What you expected to happen: Expected behaviour -> User should be able to override max retry times incase cluster is not reachable How to reproduce it (as minimally and precisely as possible): Try to reach any cluster which doesnt exist properly from the above code Anything else we need to know?: After a long time, this error is printed , Which takes literally a lot of time ! and get this error message

Screenshot 2024-03-01 at 12 46 08 AM

Environment:

showjason commented 4 months ago

Hi, here rest.py is the right code receiving the parameter retries.

roycaihw commented 3 months ago

/assign @showjason

DARSHAN-THE-CODER commented 3 months ago

Hi, here rest.py is the right code receiving the parameter retries.

It is not working, as in even retries is not getting applied

showjason commented 3 months ago

Hi, here rest.py is the right code receiving the parameter retries.

It is not working, as in even retries is not getting applied

please try the following code:

from kubernetes import client, config

conf = client.Configuration()
conf.retries = 3
config.load_kube_config(client_configuration=conf)
client.Configuration.set_default(conf)

v1 = client.CoreV1Api()

resp = v1.read_namespaced_pod("<pod_name>", "<namespace>")
print(resp)
k8s-triage-robot commented 2 weeks ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale