diff --git a/test/extended/util/annotate/generated/zz_generated.annotations.go b/test/extended/util/annotate/generated/zz_generated.annotations.go index 788a0df0394b..adb88ac4473a 100644 --- a/test/extended/util/annotate/generated/zz_generated.annotations.go +++ b/test/extended/util/annotate/generated/zz_generated.annotations.go @@ -1155,7 +1155,7 @@ var annotations = map[string]string{ "[Top Level] [sig-cli] CLI can run inside of a busybox container": "can run inside of a busybox container [Skipped:Disconnected] [Suite:openshift/conformance/parallel]", - "[Top Level] [sig-cli] Kubectl Port forwarding With a server listening on 0.0.0.0 should support forwarding over websockets": "should support forwarding over websockets [Suite:openshift/conformance/parallel] [Suite:k8s]", + "[Top Level] [sig-cli] Kubectl Port forwarding With a server listening on 0.0.0.0 should support forwarding over websockets": "should support forwarding over websockets [Skipped:Proxy] [Suite:openshift/conformance/parallel] [Suite:k8s]", "[Top Level] [sig-cli] Kubectl Port forwarding With a server listening on 0.0.0.0 that expects NO client request should support a client that connects, sends DATA, and disconnects": "should support a client that connects, sends DATA, and disconnects [Suite:openshift/conformance/parallel] [Suite:k8s]", @@ -1163,7 +1163,7 @@ var annotations = map[string]string{ "[Top Level] [sig-cli] Kubectl Port forwarding With a server listening on 0.0.0.0 that expects a client request should support a client that connects, sends NO DATA, and disconnects": "should support a client that connects, sends NO DATA, and disconnects [Suite:openshift/conformance/parallel] [Suite:k8s]", - "[Top Level] [sig-cli] Kubectl Port forwarding With a server listening on localhost should support forwarding over websockets": "should support forwarding over websockets [Suite:openshift/conformance/parallel] [Suite:k8s]", + "[Top Level] [sig-cli] Kubectl Port forwarding With a server listening on localhost should support forwarding over websockets": "should support forwarding over websockets [Skipped:Proxy] [Suite:openshift/conformance/parallel] [Suite:k8s]", "[Top Level] [sig-cli] Kubectl Port forwarding With a server listening on localhost that expects NO client request should support a client that connects, sends DATA, and disconnects": "should support a client that connects, sends DATA, and disconnects [Suite:openshift/conformance/parallel] [Suite:k8s]", @@ -1237,9 +1237,9 @@ var annotations = map[string]string{ "[Top Level] [sig-cli] Kubectl client Simple pod should return command exit codes": "should return command exit codes [Flaky] [Suite:k8s]", - "[Top Level] [sig-cli] Kubectl client Simple pod should support exec through an HTTP proxy": "should support exec through an HTTP proxy [Suite:openshift/conformance/parallel] [Suite:k8s]", + "[Top Level] [sig-cli] Kubectl client Simple pod should support exec through an HTTP proxy": "should support exec through an HTTP proxy [Skipped:Proxy] [Suite:openshift/conformance/parallel] [Suite:k8s]", - "[Top Level] [sig-cli] Kubectl client Simple pod should support exec through kubectl proxy": "should support exec through kubectl proxy [Suite:openshift/conformance/parallel] [Suite:k8s]", + "[Top Level] [sig-cli] Kubectl client Simple pod should support exec through kubectl proxy": "should support exec through kubectl proxy [Skipped:Proxy] [Suite:openshift/conformance/parallel] [Suite:k8s]", "[Top Level] [sig-cli] Kubectl client Simple pod should support exec using resource/name": "should support exec using resource/name [Suite:openshift/conformance/parallel] [Suite:k8s]", @@ -2431,9 +2431,9 @@ var annotations = map[string]string{ "[Top Level] [sig-node] Pods should support pod readiness gates [NodeFeature:PodReadinessGate]": "should support pod readiness gates [NodeFeature:PodReadinessGate] [Suite:openshift/conformance/parallel] [Suite:k8s]", - "[Top Level] [sig-node] Pods should support remote command execution over websockets [NodeConformance] [Conformance]": "should support remote command execution over websockets [NodeConformance] [Conformance] [Suite:openshift/conformance/parallel/minimal] [Suite:k8s]", + "[Top Level] [sig-node] Pods should support remote command execution over websockets [NodeConformance] [Conformance]": "should support remote command execution over websockets [NodeConformance] [Conformance] [Skipped:Proxy] [Suite:openshift/conformance/parallel/minimal] [Suite:k8s]", - "[Top Level] [sig-node] Pods should support retrieving logs from the container over websockets [NodeConformance] [Conformance]": "should support retrieving logs from the container over websockets [NodeConformance] [Conformance] [Suite:openshift/conformance/parallel/minimal] [Suite:k8s]", + "[Top Level] [sig-node] Pods should support retrieving logs from the container over websockets [NodeConformance] [Conformance]": "should support retrieving logs from the container over websockets [NodeConformance] [Conformance] [Skipped:Proxy] [Suite:openshift/conformance/parallel/minimal] [Suite:k8s]", "[Top Level] [sig-node] PreStop graceful pod terminated should wait until preStop hook completes the process": "graceful pod terminated should wait until preStop hook completes the process [Suite:openshift/conformance/parallel] [Suite:k8s]", diff --git a/test/extended/util/annotate/rules.go b/test/extended/util/annotate/rules.go index 34287628ca6e..e50199db77ae 100644 --- a/test/extended/util/annotate/rules.go +++ b/test/extended/util/annotate/rules.go @@ -144,6 +144,22 @@ var ( "[Skipped:ovirt]": {}, "[Skipped:gce]": {}, + // These tests are skipped when openshift-tests needs to use a proxy to reach the + // cluster -- either because the test won't work while proxied, or because the test + // itself is testing a functionality using it's own proxy. + "[Skipped:Proxy]": { + // These tests setup their own proxy, which won't work when we need to access the + // cluster through a proxy. + `\[sig-cli\] Kubectl client Simple pod should support exec through an HTTP proxy`, + `\[sig-cli\] Kubectl client Simple pod should support exec through kubectl proxy`, + + // Kube currently uses the x/net/websockets pkg, which doesn't work with proxies. + // See: https://github.com/kubernetes/kubernetes/pull/103595 + `\[sig-node\] Pods should support retrieving logs from the container over websockets`, + `\[sig-cli\] Kubectl Port forwarding With a server listening on localhost should support forwarding over websockets`, + `\[sig-cli\] Kubectl Port forwarding With a server listening on 0.0.0.0 should support forwarding over websockets`, + `\[sig-node\] Pods should support remote command execution over websockets`, + }, "[Skipped:SingleReplicaTopology]": { `\[sig-apps\] Daemon set \[Serial\] should rollback without unnecessary restarts \[Conformance\]`, `\[sig-node\] NoExecuteTaintManager Single Pod \[Serial\] doesn't evict pod with tolerations from tainted nodes`, diff --git a/test/extended/util/cluster/cluster.go b/test/extended/util/cluster/cluster.go index ec4e93deb2e7..45f1669a8c2f 100644 --- a/test/extended/util/cluster/cluster.go +++ b/test/extended/util/cluster/cluster.go @@ -5,6 +5,9 @@ import ( "encoding/json" "fmt" "io/ioutil" + "k8s.io/apimachinery/pkg/runtime/schema" + "net/http" + "net/url" "strings" corev1 "k8s.io/api/core/v1" @@ -55,6 +58,9 @@ type ClusterConfiguration struct { // HasSCTP determines whether SCTP connectivity tests can be run in the cluster HasSCTP bool + + // IsProxied determines whether we are accessing the cluster through an HTTP proxy + IsProxied bool } func (c *ClusterConfiguration) ToJSONString() string { @@ -68,6 +74,7 @@ func (c *ClusterConfiguration) ToJSONString() string { // ClusterState provides information about the cluster that is used to generate // ClusterConfiguration type ClusterState struct { + APIURL *url.URL PlatformStatus *configv1.PlatformStatus Masters *corev1.NodeList NonMasters *corev1.NodeList @@ -92,6 +99,12 @@ func DiscoverClusterState(clientConfig *rest.Config) (*ClusterState, error) { state := &ClusterState{} + url, _, err := rest.DefaultServerURL(clientConfig.Host, clientConfig.APIPath, schema.GroupVersion{}, false) + if err != nil { + return nil, err + } + state.APIURL = url + infra, err := configClient.ConfigV1().Infrastructures().Get(context.Background(), "cluster", metav1.GetOptions{}) if err != nil { return nil, err @@ -193,6 +206,19 @@ func LoadConfig(state *ClusterState) (*ClusterConfiguration, error) { } } + // ProxyFromEnvironment returns the URL of the proxy to use for a + // given request, as indicated by the environment variables + // HTTP_PROXY, HTTPS_PROXY and NO_PROXY. If ProxyFromEnvironment returns + // a proxy to us for a dummy API request, then we set our config to + // be proxied. + proxy, err := http.ProxyFromEnvironment(&http.Request{ + Method: http.MethodGet, + URL: state.APIURL, + }) + if err == nil && proxy != nil { + config.IsProxied = true + } + // FIXME: detect SCTP availability; there's no explicit config for it, so we'd // have to scan MachineConfig objects to figure this out? For now, callers can // can just manually override with --provider... @@ -217,6 +243,10 @@ func (c *ClusterConfiguration) MatchFn() func(string) bool { skips = append(skips, "[Skipped:Disconnected]") } + if c.IsProxied { + skips = append(skips, "[Skipped:Proxy]") + } + if c.SingleReplicaTopology { skips = append(skips, "[Skipped:SingleReplicaTopology]") }