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>
This commit is contained in:
@@ -352,9 +352,7 @@ func execPluginClientTests(t *testing.T, unauthorizedCert, unauthorizedKey []byt
|
||||
wantMetrics: &execPluginMetrics{},
|
||||
},
|
||||
{
|
||||
// This is not the behavior we would expect, see
|
||||
// https://github.com/kubernetes/kubernetes/issues/99603
|
||||
name: "good token with static auth cert and key favors exec plugin",
|
||||
name: "good token with static auth cert and key favors static cert",
|
||||
clientConfigFunc: func(c *rest.Config) {
|
||||
c.ExecProvider.Env = []clientcmdapi.ExecEnvVar{
|
||||
{
|
||||
@@ -371,9 +369,10 @@ func execPluginClientTests(t *testing.T, unauthorizedCert, unauthorizedKey []byt
|
||||
c.CertData = unauthorizedCert
|
||||
c.KeyData = unauthorizedKey
|
||||
},
|
||||
wantAuthorizationHeaderValues: [][]string{{"Bearer " + clientAuthorizedToken}},
|
||||
wantAuthorizationHeaderValues: [][]string{nil},
|
||||
wantClientErrorPrefix: "Unauthorized",
|
||||
wantCertificate: x509KeyPair(unauthorizedCert, unauthorizedKey, false),
|
||||
wantMetrics: &execPluginMetrics{calls: []execPluginCall{{exitCode: 0, callStatus: "no_error"}}},
|
||||
wantMetrics: &execPluginMetrics{},
|
||||
},
|
||||
{
|
||||
name: "unknown binary",
|
||||
@@ -482,7 +481,7 @@ func TestExecPluginViaClient(t *testing.T) {
|
||||
_, err = client.CoreV1().ConfigMaps("default").List(ctx, metav1.ListOptions{})
|
||||
if test.wantClientErrorPrefix != "" {
|
||||
if err == nil || !strings.HasPrefix(err.Error(), test.wantClientErrorPrefix) {
|
||||
t.Fatalf(`got %q, wanted "%s..."`, err, test.wantClientErrorPrefix)
|
||||
t.Fatalf(`got %v, wanted "%s..."`, err, test.wantClientErrorPrefix)
|
||||
}
|
||||
} else if err != nil {
|
||||
t.Fatal(err)
|
||||
|
Reference in New Issue
Block a user