Skip to content

Commit

Permalink
fix(provider/kubernetes): fix K8s provider outside proxy environment (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
prabdeb authored and lwander committed Mar 12, 2018
1 parent 8324822 commit a6f1919
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,19 @@ class KubernetesConfigParser {

Cluster currentCluster = KubeConfigUtils.getCluster(kubeConfig, currentContext)
config.setApiVersion("v1") // TODO(lwander) Make config parameter when new versions arrive.
config.setNoProxy([] as String[])
String httpProxy = System.getenv("HTTP_PROXY") ?: System.getenv("http_proxy")
String httpsProxy = System.getenv("HTTPS_PROXY") ?: System.getenv("https_proxy")
String noProxy = System.getenv("NO_PROXY") ?: System.getenv("no_proxy")
if (httpProxy != null && httpProxy != "") {
config.setHttpProxy(httpProxy)
}
if (httpsProxy != null && httpsProxy != "") {
config.setHttpsProxy(httpsProxy)
}
if (noProxy != null && noProxy != "") {
String[] noProxyList = noProxy.split(",")
config.setNoProxy(noProxyList)
}
if (currentCluster != null) {
if (!currentCluster.getServer().endsWith("/")) {
config.setMasterUrl(currentCluster.getServer() + "/")
Expand Down

0 comments on commit a6f1919

Please sign in to comment.