mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-19 23:57:27 +00:00
plumb the proxyTransport to the webhook admission plugin;
set the ServerName in the config for webhook admission plugin. Kubernetes-commit: 186a0684d582272aa2fbfec390aea5fbb88a8bc6
This commit is contained in:
parent
0fd8a31bad
commit
baf97d23c3
@ -114,6 +114,9 @@ type Config struct {
|
|||||||
// The maximum length of time to wait before giving up on a server request. A value of zero means no timeout.
|
// The maximum length of time to wait before giving up on a server request. A value of zero means no timeout.
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
|
|
||||||
|
// Dial specifies the dial function for creating unencrypted TCP connections.
|
||||||
|
Dial func(network, addr string) (net.Conn, error)
|
||||||
|
|
||||||
// Version forces a specific version to be used (if registered)
|
// Version forces a specific version to be used (if registered)
|
||||||
// Do we need this?
|
// Do we need this?
|
||||||
// Version string
|
// Version string
|
||||||
|
@ -96,5 +96,6 @@ func (c *Config) TransportConfig() (*transport.Config, error) {
|
|||||||
Groups: c.Impersonate.Groups,
|
Groups: c.Impersonate.Groups,
|
||||||
Extra: c.Impersonate.Extra,
|
Extra: c.Impersonate.Extra,
|
||||||
},
|
},
|
||||||
|
Dial: c.Dial,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -63,16 +63,20 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) {
|
|||||||
return http.DefaultTransport, nil
|
return http.DefaultTransport, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dial := config.Dial
|
||||||
|
if dial == nil {
|
||||||
|
dial = (&net.Dialer{
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
|
KeepAlive: 30 * time.Second,
|
||||||
|
}).Dial
|
||||||
|
}
|
||||||
// Cache a single transport for these options
|
// Cache a single transport for these options
|
||||||
c.transports[key] = utilnet.SetTransportDefaults(&http.Transport{
|
c.transports[key] = utilnet.SetTransportDefaults(&http.Transport{
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: http.ProxyFromEnvironment,
|
||||||
TLSHandshakeTimeout: 10 * time.Second,
|
TLSHandshakeTimeout: 10 * time.Second,
|
||||||
TLSClientConfig: tlsConfig,
|
TLSClientConfig: tlsConfig,
|
||||||
MaxIdleConnsPerHost: idleConnsPerHost,
|
MaxIdleConnsPerHost: idleConnsPerHost,
|
||||||
Dial: (&net.Dialer{
|
Dial: dial,
|
||||||
Timeout: 30 * time.Second,
|
|
||||||
KeepAlive: 30 * time.Second,
|
|
||||||
}).Dial,
|
|
||||||
})
|
})
|
||||||
return c.transports[key], nil
|
return c.transports[key], nil
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,10 @@ limitations under the License.
|
|||||||
|
|
||||||
package transport
|
package transport
|
||||||
|
|
||||||
import "net/http"
|
import (
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
// Config holds various options for establishing a transport.
|
// Config holds various options for establishing a transport.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@ -52,6 +55,9 @@ type Config struct {
|
|||||||
// config may layer other RoundTrippers on top of the returned
|
// config may layer other RoundTrippers on top of the returned
|
||||||
// RoundTripper.
|
// RoundTripper.
|
||||||
WrapTransport func(rt http.RoundTripper) http.RoundTripper
|
WrapTransport func(rt http.RoundTripper) http.RoundTripper
|
||||||
|
|
||||||
|
// Dial specifies the dial function for creating unencrypted TCP connections.
|
||||||
|
Dial func(network, addr string) (net.Conn, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImpersonationConfig has all the available impersonation options
|
// ImpersonationConfig has all the available impersonation options
|
||||||
|
Loading…
Reference in New Issue
Block a user