Commit 4198f288 authored by Mike Danese's avatar Mike Danese

BoundServiceAccountTokenVolume: fix InClusterConfig

parent 23fb942e
...@@ -171,6 +171,7 @@ func restConfigFromKubeconfig(configAuthInfo *clientcmdapi.AuthInfo) (*rest.Conf ...@@ -171,6 +171,7 @@ func restConfigFromKubeconfig(configAuthInfo *clientcmdapi.AuthInfo) (*rest.Conf
// blindly overwrite existing values based on precedence // blindly overwrite existing values based on precedence
if len(configAuthInfo.Token) > 0 { if len(configAuthInfo.Token) > 0 {
config.BearerToken = configAuthInfo.Token config.BearerToken = configAuthInfo.Token
config.BearerTokenFile = configAuthInfo.TokenFile
} else if len(configAuthInfo.TokenFile) > 0 { } else if len(configAuthInfo.TokenFile) > 0 {
tokenBytes, err := ioutil.ReadFile(configAuthInfo.TokenFile) tokenBytes, err := ioutil.ReadFile(configAuthInfo.TokenFile)
if err != nil { if err != nil {
......
...@@ -74,9 +74,10 @@ func (c *Config) TransportConfig() (*transport.Config, error) { ...@@ -74,9 +74,10 @@ func (c *Config) TransportConfig() (*transport.Config, error) {
KeyFile: c.KeyFile, KeyFile: c.KeyFile,
KeyData: c.KeyData, KeyData: c.KeyData,
}, },
Username: c.Username, Username: c.Username,
Password: c.Password, Password: c.Password,
BearerToken: c.BearerToken, BearerToken: c.BearerToken,
BearerTokenFile: c.BearerTokenFile,
Impersonate: transport.ImpersonationConfig{ Impersonate: transport.ImpersonationConfig{
UserName: c.Impersonate.UserName, UserName: c.Impersonate.UserName,
Groups: c.Impersonate.Groups, Groups: c.Impersonate.Groups,
......
...@@ -228,6 +228,7 @@ func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthI ...@@ -228,6 +228,7 @@ func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthI
// blindly overwrite existing values based on precedence // blindly overwrite existing values based on precedence
if len(configAuthInfo.Token) > 0 { if len(configAuthInfo.Token) > 0 {
mergedConfig.BearerToken = configAuthInfo.Token mergedConfig.BearerToken = configAuthInfo.Token
mergedConfig.BearerTokenFile = configAuthInfo.TokenFile
} else if len(configAuthInfo.TokenFile) > 0 { } else if len(configAuthInfo.TokenFile) > 0 {
tokenBytes, err := ioutil.ReadFile(configAuthInfo.TokenFile) tokenBytes, err := ioutil.ReadFile(configAuthInfo.TokenFile)
if err != nil { if err != nil {
...@@ -491,6 +492,7 @@ func (config *inClusterClientConfig) ClientConfig() (*restclient.Config, error) ...@@ -491,6 +492,7 @@ func (config *inClusterClientConfig) ClientConfig() (*restclient.Config, error)
} }
if token := config.overrides.AuthInfo.Token; len(token) > 0 { if token := config.overrides.AuthInfo.Token; len(token) > 0 {
icc.BearerToken = token icc.BearerToken = token
icc.BearerTokenFile = ""
} }
if certificateAuthorityFile := config.overrides.ClusterInfo.CertificateAuthority; len(certificateAuthorityFile) > 0 { if certificateAuthorityFile := config.overrides.ClusterInfo.CertificateAuthority; len(certificateAuthorityFile) > 0 {
icc.TLSClientConfig.CAFile = certificateAuthorityFile icc.TLSClientConfig.CAFile = certificateAuthorityFile
......
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