Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions test/extended/util/annotate/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
30 changes: 30 additions & 0 deletions test/extended/util/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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...
Expand All @@ -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]")
}
Expand Down