mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
add ingress connectivity check and dns check
This commit is contained in:
parent
5c3667e8c2
commit
cf26597ae8
@ -18,11 +18,11 @@ package e2e
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_4"
|
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_4"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
@ -78,11 +78,11 @@ var _ = framework.KubeDescribe("Federation ingresses [Feature:Federation]", func
|
|||||||
})
|
})
|
||||||
|
|
||||||
// e2e cases for federation ingress controller
|
// e2e cases for federation ingress controller
|
||||||
var _ = Describe("Federated Ingress controller", func() {
|
var _ = Describe("Federated Ingresses", func() {
|
||||||
var (
|
var (
|
||||||
clusters map[string]*cluster // All clusters, keyed by cluster name
|
clusters map[string]*cluster // All clusters, keyed by cluster name
|
||||||
primaryClusterName, federationName, ns string
|
primaryClusterName, federationName, ns string
|
||||||
jig *federationTestJig
|
jig *federationTestJig
|
||||||
)
|
)
|
||||||
|
|
||||||
// register clusters in federation apiserver
|
// register clusters in federation apiserver
|
||||||
@ -357,7 +357,7 @@ type federationTestJig struct {
|
|||||||
rootCAs map[string][]byte
|
rootCAs map[string][]byte
|
||||||
address string
|
address string
|
||||||
ing *v1beta1.Ingress
|
ing *v1beta1.Ingress
|
||||||
client *federation_release_1_4.Clientset
|
client *federation_release_1_4.Clientset
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFederationTestJig(c *federation_release_1_4.Clientset) *federationTestJig {
|
func newFederationTestJig(c *federation_release_1_4.Clientset) *federationTestJig {
|
||||||
|
@ -125,10 +125,10 @@ var _ = framework.KubeDescribe("Loadbalancing: L7 [Feature:Ingress]", func() {
|
|||||||
|
|
||||||
By("waiting for Ingress to come up with ip: " + ip)
|
By("waiting for Ingress to come up with ip: " + ip)
|
||||||
httpClient := buildInsecureClient(reqTimeout)
|
httpClient := buildInsecureClient(reqTimeout)
|
||||||
ExpectNoError(jig.pollURL(fmt.Sprintf("https://%v/", ip), "", lbPollTimeout, httpClient, false))
|
ExpectNoError(pollURL(fmt.Sprintf("https://%v/", ip), "", lbPollTimeout, httpClient, false))
|
||||||
|
|
||||||
By("should reject HTTP traffic")
|
By("should reject HTTP traffic")
|
||||||
ExpectNoError(jig.pollURL(fmt.Sprintf("http://%v/", ip), "", lbPollTimeout, httpClient, true))
|
ExpectNoError(pollURL(fmt.Sprintf("http://%v/", ip), "", lbPollTimeout, httpClient, true))
|
||||||
|
|
||||||
// TODO: uncomment the restart test once we have a way to synchronize
|
// TODO: uncomment the restart test once we have a way to synchronize
|
||||||
// and know that the controller has resumed watching. If we delete
|
// and know that the controller has resumed watching. If we delete
|
||||||
|
@ -145,7 +145,7 @@ func createComformanceTests(jig *testJig, ns string) []conformanceTests {
|
|||||||
})
|
})
|
||||||
By("Checking that " + pathToFail + " is not exposed by polling for failure")
|
By("Checking that " + pathToFail + " is not exposed by polling for failure")
|
||||||
route := fmt.Sprintf("http://%v%v", jig.address, pathToFail)
|
route := fmt.Sprintf("http://%v%v", jig.address, pathToFail)
|
||||||
ExpectNoError(jig.pollURL(route, updateURLMapHost, lbCleanupTimeout, &http.Client{Timeout: reqTimeout}, true))
|
ExpectNoError(pollURL(route, updateURLMapHost, lbCleanupTimeout, &http.Client{Timeout: reqTimeout}, true))
|
||||||
},
|
},
|
||||||
fmt.Sprintf("Waiting for path updates to reflect in L7"),
|
fmt.Sprintf("Waiting for path updates to reflect in L7"),
|
||||||
},
|
},
|
||||||
@ -154,7 +154,7 @@ func createComformanceTests(jig *testJig, ns string) []conformanceTests {
|
|||||||
|
|
||||||
// pollURL polls till the url responds with a healthy http code. If
|
// pollURL polls till the url responds with a healthy http code. If
|
||||||
// expectUnreachable is true, it breaks on first non-healthy http code instead.
|
// expectUnreachable is true, it breaks on first non-healthy http code instead.
|
||||||
func (j *testJig) pollURL(route, host string, timeout time.Duration, httpClient *http.Client, expectUnreachable bool) error {
|
func pollURL(route, host string, timeout time.Duration, httpClient *http.Client, expectUnreachable bool) error {
|
||||||
var lastBody string
|
var lastBody string
|
||||||
pollErr := wait.PollImmediate(lbPollInterval, timeout, func() (bool, error) {
|
pollErr := wait.PollImmediate(lbPollInterval, timeout, func() (bool, error) {
|
||||||
var err error
|
var err error
|
||||||
@ -638,7 +638,7 @@ func (j *testJig) waitForIngress() {
|
|||||||
j.curlServiceNodePort(j.ing.Namespace, p.Backend.ServiceName, int(p.Backend.ServicePort.IntVal))
|
j.curlServiceNodePort(j.ing.Namespace, p.Backend.ServiceName, int(p.Backend.ServicePort.IntVal))
|
||||||
route := fmt.Sprintf("%v://%v%v", proto, address, p.Path)
|
route := fmt.Sprintf("%v://%v%v", proto, address, p.Path)
|
||||||
framework.Logf("Testing route %v host %v with simple GET", route, rules.Host)
|
framework.Logf("Testing route %v host %v with simple GET", route, rules.Host)
|
||||||
ExpectNoError(j.pollURL(route, rules.Host, lbPollTimeout, timeoutClient, false))
|
ExpectNoError(pollURL(route, rules.Host, lbPollTimeout, timeoutClient, false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -662,7 +662,7 @@ func (j *testJig) curlServiceNodePort(ns, name string, port int) {
|
|||||||
// TODO: Curl all nodes?
|
// TODO: Curl all nodes?
|
||||||
u, err := framework.GetNodePortURL(j.client, ns, name, port)
|
u, err := framework.GetNodePortURL(j.client, ns, name, port)
|
||||||
ExpectNoError(err)
|
ExpectNoError(err)
|
||||||
ExpectNoError(j.pollURL(u, "", 30*time.Second, &http.Client{Timeout: reqTimeout}, false))
|
ExpectNoError(pollURL(u, "", 30*time.Second, &http.Client{Timeout: reqTimeout}, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ingFromManifest reads a .json/yaml file and returns the rc in it.
|
// ingFromManifest reads a .json/yaml file and returns the rc in it.
|
||||||
|
Loading…
Reference in New Issue
Block a user