Skip to content

Commit 99aa6a2

Browse files
committed
fix: removes fence code on nil default transport and avoids proxy
Signed-off-by: Billy Zha <[email protected]>
1 parent 7d70187 commit 99aa6a2

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

pkg/credentialprovider/identity_bindings_credentials.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,9 @@ type tokenResponse struct {
6565
// createTransport creates an HTTP transport with custom CA
6666
// The transport uses a custom dialer that resolves the SNI name to the configured API server IP
6767
func createTransport(sniName string, apiServerIP string, caPool *x509.CertPool) *http.Transport {
68-
var transport *http.Transport
69-
if tr, ok := http.DefaultTransport.(*http.Transport); ok {
70-
transport = tr.Clone()
71-
} else {
72-
transport = &http.Transport{
73-
ForceAttemptHTTP2: true,
74-
MaxIdleConns: 100,
75-
IdleConnTimeout: 90 * time.Second,
76-
TLSHandshakeTimeout: 10 * time.Second,
77-
}
78-
}
68+
transport := http.DefaultTransport.(*http.Transport).Clone()
69+
// reset Proxy to avoid using environment proxy settings
70+
transport.Proxy = nil
7971

8072
// Custom dialer that resolves the SNI hostname to the fixed API server IP
8173
transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {

0 commit comments

Comments
 (0)