Merge pull request #1911 from erictune/token_client

Handle auth files with BearerToken sections.
This commit is contained in:
Clayton Coleman
2014-10-21 14:08:42 -04:00
6 changed files with 39 additions and 14 deletions

View File

@@ -52,12 +52,13 @@ func promptForString(field string, r io.Reader) string {
}
type AuthInfo struct {
User string
Password string
CAFile string
CertFile string
KeyFile string
Insecure *bool
User string
Password string
CAFile string
CertFile string
KeyFile string
BearerToken string
Insecure *bool
}
type NamespaceInfo struct {

View File

@@ -171,6 +171,7 @@ func getKubeClient(cmd *cobra.Command) *client.Client {
config.CAFile = firstNonEmptyString(getFlagString(cmd, "certificate-authority"), authInfo.CAFile)
config.CertFile = firstNonEmptyString(getFlagString(cmd, "client-certificate"), authInfo.CertFile)
config.KeyFile = firstNonEmptyString(getFlagString(cmd, "client-key"), authInfo.KeyFile)
config.BearerToken = authInfo.BearerToken
// For config.Insecure, the command line ALWAYS overrides the authInfo
// file, regardless of its setting.
if insecureFlag := getFlagBoolPtr(cmd, "insecure-skip-tls-verify"); insecureFlag != nil {

View File

@@ -59,12 +59,13 @@ func GetKubeClient(config *client.Config, matchVersion bool) (*client.Client, er
}
type AuthInfo struct {
User string
Password string
CAFile string
CertFile string
KeyFile string
Insecure *bool
User string
Password string
CAFile string
CertFile string
KeyFile string
BearerToken string
Insecure *bool
}
// LoadAuthInfo parses an AuthInfo object from a file path. It prompts user and creates file if it doesn't exist.