Merge pull request #56419 from liggitt/automated-cherry-pick-of-#56415-upstream-release-1.7

Automatic merge from submit-queue.

Automated cherry pick of #56415

Cherry pick of #56415 on release-1.7.

#56415: Include ServerName in tls transport cache key

Kubernetes-commit: 304233a0bba4a00fd42bfc4a6b030c30b40b6ffa
This commit is contained in:
Kubernetes Publisher
2017-11-29 04:56:08 -08:00
2 changed files with 15 additions and 1 deletions

View File

@@ -84,5 +84,5 @@ func tlsConfigKey(c *Config) (string, error) {
return "", err
}
// Only include the things that actually affect the tls.Config
return fmt.Sprintf("%v/%x/%x/%x", c.TLS.Insecure, c.TLS.CAData, c.TLS.CertData, c.TLS.KeyData), nil
return fmt.Sprintf("%v/%x/%x/%x/%v", c.TLS.Insecure, c.TLS.CAData, c.TLS.CertData, c.TLS.KeyData, c.TLS.ServerName), nil
}

View File

@@ -62,6 +62,20 @@ func TestTLSConfigKey(t *testing.T) {
KeyData: []byte{1},
},
},
"cert 1, key 1, servername 1": {
TLS: TLSConfig{
CertData: []byte{1},
KeyData: []byte{1},
ServerName: "1",
},
},
"cert 1, key 1, servername 2": {
TLS: TLSConfig{
CertData: []byte{1},
KeyData: []byte{1},
ServerName: "2",
},
},
"cert 1, key 2": {
TLS: TLSConfig{
CertData: []byte{1},