mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-22 13:17:07 +00:00
Check whether static cert is already configured in UpdateTransportConfig
- Also update test-cmd.sh to pass a signing ca to the kube controller manager, so CSRs work properly in integration tests. Signed-off-by: Margo Crawford <margaretc@vmware.com> Kubernetes-commit: f015fd66ce95d02cd66efc263eb9e5441b42a17d
This commit is contained in:
parent
0a04e978b0
commit
2b59dabd4c
@ -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