mirror of https://github.com/kubernetes/kops.git
Merge pull request #10181 from rifelpet/bearer-cleanup
Remove unused bearer token field from kubeconfig builder
This commit is contained in:
commit
1200083400
|
@ -34,7 +34,6 @@ type KubeconfigBuilder struct {
|
||||||
Namespace string
|
Namespace string
|
||||||
|
|
||||||
User string
|
User string
|
||||||
KubeBearerToken string
|
|
||||||
KubeUser string
|
KubeUser string
|
||||||
KubePassword string
|
KubePassword string
|
||||||
|
|
||||||
|
@ -86,14 +85,8 @@ func (c *KubeconfigBuilder) BuildRestConfig() (*rest.Config, error) {
|
||||||
restConfig.CAData = c.CACert
|
restConfig.CAData = c.CACert
|
||||||
restConfig.CertData = c.ClientCert
|
restConfig.CertData = c.ClientCert
|
||||||
restConfig.KeyData = c.ClientKey
|
restConfig.KeyData = c.ClientKey
|
||||||
|
|
||||||
// username/password or bearer token may be set, but not both
|
|
||||||
if c.KubeBearerToken != "" {
|
|
||||||
restConfig.BearerToken = c.KubeBearerToken
|
|
||||||
} else {
|
|
||||||
restConfig.Username = c.KubeUser
|
restConfig.Username = c.KubeUser
|
||||||
restConfig.Password = c.KubePassword
|
restConfig.Password = c.KubePassword
|
||||||
}
|
|
||||||
|
|
||||||
return restConfig, nil
|
return restConfig, nil
|
||||||
}
|
}
|
||||||
|
@ -130,9 +123,7 @@ func (b *KubeconfigBuilder) WriteKubecfg(configAccess clientcmd.ConfigAccess) er
|
||||||
authInfo = clientcmdapi.NewAuthInfo()
|
authInfo = clientcmdapi.NewAuthInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.KubeBearerToken != "" {
|
if b.KubeUser != "" && b.KubePassword != "" {
|
||||||
authInfo.Token = b.KubeBearerToken
|
|
||||||
} else if b.KubeUser != "" && b.KubePassword != "" {
|
|
||||||
authInfo.Username = b.KubeUser
|
authInfo.Username = b.KubeUser
|
||||||
authInfo.Password = b.KubePassword
|
authInfo.Password = b.KubePassword
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue