kubeclient icon indicating copy to clipboard operation
kubeclient copied to clipboard

$no_proxy support?

Open chino opened this issue 8 years ago • 2 comments

Normally proxy settings are automatically picked up via $http(s)_proxy env vars and also importantly $no_proxy which determines when NOT to use the proxy. Ruby's core http libs already support all of this automatically.

I see some scattered notes regarding env vars in the rest-client lib:

https://github.com/rest-client/rest-client#proxy https://github.com/rest-client/rest-client/blob/master/spec/unit/request_spec.rb#L580

This is actually affecting me while trying to use the k8s plugin in gitlab:

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/models/project_services/kubernetes_service.rb#L169

It seems proper $no_proxy support and/or env var support would be right way to go?

chino avatar Nov 10 '17 01:11 chino

Thanks. Can you help us map out the current situation? A PR with just tests for current kubeclient behavior would be wonderful (but manual "this worked and this didn't" is welcome too).

Note that kubeclient uses 2 libs — http for watches and rest-client for all other requests. rest-client is based on ruby's core Net::HTTP, http gem isn't. IIUC the rest-client test you link, it tests that rest-client respects $http_proxy by default but programmatic proxy: nil can override it. It doesn't meaningfully test no_proxy.

cben avatar Mar 04 '18 11:03 cben

Also, is current kubeclient API adequate if you're willing to parse env vars yourself? https://github.com/abonas/kubeclient#proxies — you can set http_proxy_uri but can't specify a no_proxy set of hosts, right? Ooh, this seems useful: https://ruby-doc.org/stdlib-2.2.0/libdoc/uri/rdoc/URI/Generic.html#method-i-find_proxy

Are these env vars standardized anywhere? I found https://wiki.archlinux.org/index.php/proxy_settings, sounds more like convention than standard.

P.S. found that Net::HTTP.new recently gained no_proxy param (but already supported no_proxy env var): https://bugs.ruby-lang.org/issues/11195

cben avatar Mar 04 '18 11:03 cben