mirror of https://github.com/k3s-io/k3s
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
parent
92e0c231fa
commit
93abdb1205
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue