diff --git a/test/extended/util/annotate/generated/zz_generated.annotations.go b/test/extended/util/annotate/generated/zz_generated.annotations.go index dbb89d822b24..1281fa6d0f93 100644 --- a/test/extended/util/annotate/generated/zz_generated.annotations.go +++ b/test/extended/util/annotate/generated/zz_generated.annotations.go @@ -1149,7 +1149,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]", @@ -1157,7 +1157,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]", @@ -1231,9 +1231,9 @@ var annotations = map[string]string{ "[Top Level] [sig-cli] Kubectl client Simple pod should return command exit codes": "should return command exit codes [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 [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]", @@ -2413,9 +2413,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 80c5c3fe328e..42cf839bc228 100644 --- a/test/extended/util/annotate/rules.go +++ b/test/extended/util/annotate/rules.go @@ -83,6 +83,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`, + }, // Tests that don't pass on disconnected, either due to requiring // internet access for GitHub (e.g. many of the s2i builds), or // because of pullthrough not supporting ICSP (https://bugzilla.redhat.com/show_bug.cgi?id=1918376) diff --git a/test/extended/util/cluster/cluster.go b/test/extended/util/cluster/cluster.go index b4459b86b1e1..25c9b4dd5726 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" @@ -51,6 +54,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 { @@ -64,6 +70,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 @@ -87,6 +94,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 @@ -183,6 +196,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... @@ -207,6 +233,10 @@ func (c *ClusterConfiguration) MatchFn() func(string) bool { skips = append(skips, "[Skipped:Disconnected]") } + if c.IsProxied { + skips = append(skips, "[Skipped:Proxy]") + } + if !c.HasIPv4 { skips = append(skips, "[Feature:Networking-IPv4]") }