mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
DynamicControllerClientBuilder: use already provided config when creating new clients
It is the caller's responsibility to remove sensitive information prior to creation. This allows for potential extensions in the future. For example, it preserves HTTP wrappers for custom behavior per request.
This commit is contained in:
parent
fa118e23ec
commit
c40a780f9b
@ -235,7 +235,11 @@ func (ts *tokenSourceImpl) Token() (*oauth2.Token, error) {
|
||||
|
||||
func constructClient(saNamespace, saName string, config *restclient.Config) restclient.Config {
|
||||
username := apiserverserviceaccount.MakeUsername(saNamespace, saName)
|
||||
ret := *restclient.AnonymousClientConfig(config)
|
||||
// make a shallow copy
|
||||
// the caller already castrated the config during creation
|
||||
// this allows for potential extensions in the future
|
||||
// for example it preserve HTTP wrappers for custom behavior per request
|
||||
ret := *config
|
||||
restclient.AddUserAgent(&ret, username)
|
||||
return ret
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user