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

parent 20698272
...@@ -18,6 +18,7 @@ package rest ...@@ -18,6 +18,7 @@ package rest
import ( import (
"crypto/tls" "crypto/tls"
"errors"
"net/http" "net/http"
"k8s.io/client-go/plugin/pkg/client/auth/exec" "k8s.io/client-go/plugin/pkg/client/auth/exec"
...@@ -83,6 +84,11 @@ func (c *Config) TransportConfig() (*transport.Config, error) { ...@@ -83,6 +84,11 @@ func (c *Config) TransportConfig() (*transport.Config, error) {
}, },
Dial: c.Dial, 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 { if c.ExecProvider != nil {
provider, err := exec.GetAuthenticator(c.ExecProvider) provider, err := exec.GetAuthenticator(c.ExecProvider)
if err != nil { if err != nil {
......
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