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: 's avatarMikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
parent 92e0c231
...@@ -4226,7 +4226,7 @@ func OpenWebSocketForURL(url *url.URL, config *restclient.Config, protocols []st ...@@ -4226,7 +4226,7 @@ func OpenWebSocketForURL(url *url.URL, config *restclient.Config, protocols []st
if err != nil { if err != nil {
return nil, fmt.Errorf("Failed to create tls config: %v", err) return nil, fmt.Errorf("Failed to create tls config: %v", err)
} }
if tlsConfig != nil { if tlsConfig != nil || url.Scheme == "https" {
url.Scheme = "wss" url.Scheme = "wss"
if !strings.Contains(url.Host, ":") { if !strings.Contains(url.Host, ":") {
url.Host += ":443" url.Host += ":443"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment