mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-19 16:24:33 +00:00
Merge pull request #1911 from erictune/token_client
Handle auth files with BearerToken sections.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user