Set connrotation dialer via restclient.Config.Dialer

Instead of Transport. This fixes ExecPlugin, which fails if
restclient.Config.Transport is set.

Kubernetes-commit: 3357b5ecf42db9bcf6e54c9d2b6712cfbae077bf
This commit is contained in:
Andrew Lytvynov 2018-07-25 16:22:32 -07:00 committed by Kubernetes Publisher
parent 3db81bdd12
commit dd5f11e1e6

View File

@ -20,6 +20,7 @@ import (
"bytes" "bytes"
"context" "context"
"crypto/tls" "crypto/tls"
"errors"
"fmt" "fmt"
"io" "io"
"net" "net"
@ -179,21 +180,10 @@ func (a *Authenticator) UpdateTransportConfig(c *transport.Config) error {
return &roundTripper{a, rt} return &roundTripper{a, rt}
} }
getCert := c.TLS.GetCert if c.TLS.GetCert != nil {
c.TLS.GetCert = func() (*tls.Certificate, error) { return errors.New("can't add TLS certificate callback: transport.Config.TLS.GetCert already set")
// If previous GetCert is present and returns a valid non-nil
// certificate, use that. Otherwise use cert from exec plugin.
if getCert != nil {
cert, err := getCert()
if err != nil {
return nil, err
}
if cert != nil {
return cert, nil
}
}
return a.cert()
} }
c.TLS.GetCert = a.cert
var dial func(ctx context.Context, network, addr string) (net.Conn, error) var dial func(ctx context.Context, network, addr string) (net.Conn, error)
if c.Dial != nil { if c.Dial != nil {