Fix websocket e2e tests for https endpoints

When running e2e conformance tests against a public https protected
APIserver the websocket tests would fail because it fell back to using
`ws://` instead of `wss://` for the websocket connection.

This happened because the code detect if HTTPS is used only looks for
HTTPS related configuration in the kubeconfig, like a custom CA or
certificates.

The fix is to always use HTTPS when the apiserver URL has the scheme `https://`.

Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
pull/564/head
Mikkel Oscar Lyderik Larsen 2019-01-17 21:53:32 +01:00
parent 92e0c231fa
commit 93abdb1205
No known key found for this signature in database
GPG Key ID: 50AD98B2A0D8D4EF
1 changed files with 1 additions and 1 deletions

View File

@ -4226,7 +4226,7 @@ func OpenWebSocketForURL(url *url.URL, config *restclient.Config, protocols []st
if err != nil {
return nil, fmt.Errorf("Failed to create tls config: %v", err)
}
if tlsConfig != nil {
if tlsConfig != nil || url.Scheme == "https" {
url.Scheme = "wss"
if !strings.Contains(url.Host, ":") {
url.Host += ":443"