Commit f0fdfd96 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #15101 from liggitt/kubelet_bearer_token

Auto commit by PR queue bot
parents bc61bcc1 120e8727
......@@ -100,6 +100,9 @@ type KubeletConfig struct {
// TLSClientConfig contains settings to enable transport layer security
TLSClientConfig
// Server requires Bearer authentication
BearerToken string
// HTTPTimeout is used by the client to timeout http requests to Kubelet.
HTTPTimeout time.Duration
......
......@@ -50,14 +50,20 @@ func MakeTransport(config *KubeletConfig) (http.RoundTripper, error) {
if err != nil {
return nil, err
}
transport := http.DefaultTransport
if config.Dial != nil || tlsConfig != nil {
return util.SetTransportDefaults(&http.Transport{
transport = util.SetTransportDefaults(&http.Transport{
Dial: config.Dial,
TLSClientConfig: tlsConfig,
}), nil
} else {
return http.DefaultTransport, nil
})
}
if len(config.BearerToken) > 0 {
transport = NewBearerAuthRoundTripper(config.BearerToken, transport)
}
return transport, nil
}
// TODO: this structure is questionable, it should be using client.Config and overriding defaults.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment