Closed tanguydelignieresaccenture closed 1 year ago
Hi, no_proxy should be handled as pointed out in https://github.com/devopsspiral/KubeLibrary/pull/122#issuecomment-1341458691. If setting env is not working this needs to be fixed.
Thanks @m-wcislo, I've seen your comment, but I do not see where in the kubernetes client the no_proxy/NO_PROXY is set by default from env var in configuration.no_proxy for https://github.com/kubernetes-client/python/blob/5a96bbcbe21a552cc1f9cda13e0522fafb0dbac8/kubernetes/client/rest.py#L87 to use it.
Yeah it should be taken by requests library by default if no_proxy is empty in kubeclient . But this need to be verified, could you try setting no_proxy env var, if you didn't try already? The problem with those proxy changes is that i don't have a good way of verifying things, apart from debugging.
Maybe I was not clear, but that's why I opened this issue.
I have http(s)_proxy/HTTP(S)_PROXY/no_proxy/NO_PROXY env var set, and I confirm that in v0.8.4 only http(s)_proxy/HTTP(S)_PROXY are used, not no_proxy/NO_PROXY, which in my case make kubeneretes client calls fail as it is using the proxy for hostnames in my no_proxy/NO_PROXY env var.
In the meantime, In v0.8.3, as proxy env var was not correctly managed at KubeLibrary level, it was working for me (like if no_proxy was correctly used).
Hope it's clearer now.
Ok understood, I will work on the fix.
To summarize:
v0.8.3
http(s)_proxy=proxy.mycompany.com:80
HTTP(s)_PROXY=proxy.mycompany.com:80
no_proxy=*.otherdomain.com
NO_PROXY=*.otherdomain.com
kubernetes client api calls to api server under anapiserver.otherdomain.com
: OK, because no proxy settings are really used (due to #128)
v0.8.4
http(s)_proxy=proxy.mycompany.com:80
HTTP(s)_PROXY=proxy.mycompany.com:80
no_proxy=*.otherdomain.com
NO_PROXY=*.otherdomain.com
kubernetes client api calls to api server under anapiserver.otherdomain.com
: KO, because proxy settings are used (thanks to #129) but as no_proxy is still not really used interally, it makes "no proxy" calls to be proxied.
Hi, please check out #132 . Let me know if it is possible to test it on your side, if not I will merge it as is (tested on local and ci without real proxy).
MW.
Hi and thanks @m-wcislo. I'll try to test it on my side. I'll let you know quickly.
@m-wcislo I've been able to test it and confirm that #132 fix the issue, making no_proxy
/NO_PROXY
env var well managed by KubeLibrary.
@tanguydelignieresaccenture thanks for help. Merged.
Following
v0.8.4
, http_proxy/https_proxy/HTTP_PROXY/HTTPS_PROXY are now well managed (#128, #129). But it misses the no_proxy/NO_PROXY retrieval from env var and assignation on Configuration._default.no_proxyDue to that I'm now facing a regression compared to
v0.8.3
as the api server I must connect to is concerned by the no_proxy/NO_PROXY and proxy environnement usage is now enforced inv0.8.4
.My workaround for this case is to drop proxy setting before using KubeLibrary: