client-go: make exec auth and auth provider mutually exclusive

This commit is contained in:
Eric Chiang
2018-06-01 10:34:45 -07:00
parent 2069827239
commit d96fd39651

View File

@@ -18,6 +18,7 @@ package rest
import (
"crypto/tls"
"errors"
"net/http"
"k8s.io/client-go/plugin/pkg/client/auth/exec"
@@ -83,6 +84,11 @@ func (c *Config) TransportConfig() (*transport.Config, error) {
},
Dial: c.Dial,
}
if c.ExecProvider != nil && c.AuthProvider != nil {
return nil, errors.New("execProvider and authProvider cannot be used in combination")
}
if c.ExecProvider != nil {
provider, err := exec.GetAuthenticator(c.ExecProvider)
if err != nil {