mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-15 16:03:09 +00:00
Merge pull request #107410 from margocrawf/master
Ensure static certs in kubeconfig override exec plugin Kubernetes-commit: 19935de5a9a4196f23f9a90cd9b7acb79091e3c2
This commit is contained in:
commit
2f52a105e6
@ -290,8 +290,8 @@ func (a *Authenticator) UpdateTransportConfig(c *transport.Config) error {
|
||||
// also configured to allow client certificates for authentication. For requests
|
||||
// like "kubectl get --token (token) pods" we should assume the intention is to
|
||||
// use the provided token for authentication. The same can be said for when the
|
||||
// user specifies basic auth.
|
||||
if c.HasTokenAuth() || c.HasBasicAuth() {
|
||||
// user specifies basic auth or cert auth.
|
||||
if c.HasTokenAuth() || c.HasBasicAuth() || c.HasCertAuth() {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ func (a *Authenticator) UpdateTransportConfig(c *transport.Config) error {
|
||||
return &roundTripper{a, rt}
|
||||
})
|
||||
|
||||
if c.TLS.GetCert != nil {
|
||||
if c.HasCertCallback() {
|
||||
return errors.New("can't add TLS certificate callback: transport.Config.TLS.GetCert already set")
|
||||
}
|
||||
c.TLS.GetCert = a.cert
|
||||
|
@ -1206,6 +1206,13 @@ func TestAuthorizationHeaderPresentCancelsExecAction(t *testing.T) {
|
||||
config.Password = "zelda"
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "cert auth",
|
||||
setTransportConfig: func(config *transport.Config) {
|
||||
config.TLS.CertData = []byte("some-cert-data")
|
||||
config.TLS.KeyData = []byte("some-key-data")
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user