mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #15101 from liggitt/kubelet_bearer_token
Auto commit by PR queue bot
This commit is contained in:
commit
f0fdfd96a0
@ -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 New Issue
Block a user