Merge pull request #52660 from kad/npapi
Automatic merge from submit-queue (batch tested with PRs 50988, 50509, 52660, 52663, 52250). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. To be consistent with http package, check also no_proxy **What this PR does / why we need it**: 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. Example: cluster will not be able to access service or pod CIDRs in case user uses lower case version of proxy variables. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
		@@ -256,8 +256,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
 | 
					// NewProxierWithNoProxyCIDR constructs a Proxier function that respects CIDRs in NO_PROXY and delegates if
 | 
				
			||||||
// no matching CIDRs are found
 | 
					// no matching CIDRs are found
 | 
				
			||||||
func NewProxierWithNoProxyCIDR(delegate func(req *http.Request) (*url.URL, error)) func(req *http.Request) (*url.URL, error) {
 | 
					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")
 | 
						noProxyEnv := os.Getenv("NO_PROXY")
 | 
				
			||||||
 | 
						if noProxyEnv == "" {
 | 
				
			||||||
 | 
							noProxyEnv = os.Getenv("no_proxy")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	noProxyRules := strings.Split(noProxyEnv, ",")
 | 
						noProxyRules := strings.Split(noProxyEnv, ",")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cidrs := []*net.IPNet{}
 | 
						cidrs := []*net.IPNet{}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user