mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-03-26 20:35:41 -04:00
Merge pull request #15101 from liggitt/kubelet_bearer_token
Auto commit by PR queue bot
This commit is contained in:
commit
f0fdfd96a0
2 changed files with 13 additions and 4 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue