From 92350f336b7aec303ba502c785d13f0cab1ad7f8 Mon Sep 17 00:00:00 2001 From: Alexander Kanevskiy Date: Mon, 18 Sep 2017 19:05:14 +0300 Subject: [PATCH] To be consistent with http package, check also no_proxy Default http.ProxyFromEnvironment uses uppper case proxy environment variables first, and if they are not defined, tries lower case. For NewProxierWithNoProxyCIDR we should provide similar user experience. --- staging/src/k8s.io/apimachinery/pkg/util/net/http.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/apimachinery/pkg/util/net/http.go b/staging/src/k8s.io/apimachinery/pkg/util/net/http.go index 77488388c64..ed736fe1a5d 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/net/http.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/net/http.go @@ -235,8 +235,11 @@ func isDefault(transportProxier func(*http.Request) (*url.URL, error)) bool { // NewProxierWithNoProxyCIDR constructs a Proxier function that respects CIDRs in NO_PROXY and delegates if // no matching CIDRs are found func NewProxierWithNoProxyCIDR(delegate func(req *http.Request) (*url.URL, error)) func(req *http.Request) (*url.URL, error) { - // we wrap the default method, so we only need to perform our check if the NO_PROXY envvar has a CIDR in it + // we wrap the default method, so we only need to perform our check if the NO_PROXY (or no_proxy) envvar has a CIDR in it noProxyEnv := os.Getenv("NO_PROXY") + if noProxyEnv == "" { + noProxyEnv = os.Getenv("no_proxy") + } noProxyRules := strings.Split(noProxyEnv, ",") cidrs := []*net.IPNet{}