Refactor e2e tests to use the service ClusterIP
This commit is contained in:
parent
f04361cc06
commit
5e249d3366
80 changed files with 777 additions and 706 deletions
|
|
@ -39,7 +39,7 @@ var _ = framework.IngressNginxDescribe("Configmap change", func() {
|
|||
It("should reload after an update in the configuration", func() {
|
||||
host := "configmap-change"
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
wlKey := "whitelist-source-range"
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
|||
BeforeEach(func() {
|
||||
f.NewEchoDeploymentWithReplicas(1)
|
||||
|
||||
framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
||||
framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||
func(deployment *appsv1beta1.Deployment) error {
|
||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||
args = append(args, "--disable-catch-all=true")
|
||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||
|
||||
return err
|
||||
})
|
||||
|
|
@ -54,10 +54,10 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
|||
It("should ignore catch all Ingress", func() {
|
||||
host := "foo"
|
||||
|
||||
ing := framework.NewSingleCatchAllIngress("catch-all", f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
ing := framework.NewSingleCatchAllIngress("catch-all", f.Namespace, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
ing = framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
ing = framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host, func(cfg string) bool {
|
||||
|
|
@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
|||
It("should delete Ingress updated to catch-all", func() {
|
||||
host := "foo"
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
|
|
@ -82,13 +82,13 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||
|
||||
err := framework.UpdateIngress(f.KubeClientSet, f.IngressController.Namespace, host, func(ingress *extensions.Ingress) error {
|
||||
err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *extensions.Ingress) error {
|
||||
ingress.Spec.Rules = nil
|
||||
ingress.Spec.Backend = &extensions.IngressBackend{
|
||||
ServiceName: "http-svc",
|
||||
|
|
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
|||
})
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
|
|
@ -113,7 +113,7 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
|||
It("should allow Ingress with both a default backend and rules", func() {
|
||||
host := "foo"
|
||||
|
||||
ing := framework.NewSingleIngressWithBackendAndRules("not-catch-all", "/rulepath", host, f.IngressController.Namespace, "http-svc", 80, "http-svc", 80, nil)
|
||||
ing := framework.NewSingleIngressWithBackendAndRules("not-catch-all", "/rulepath", host, f.Namespace, "http-svc", 80, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host, func(cfg string) bool {
|
||||
|
|
@ -121,7 +121,7 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ var _ = framework.IngressNginxDescribe("X-Forwarded headers", func() {
|
|||
|
||||
f.UpdateNginxConfigMapData(setting, "true")
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
|
|
@ -55,7 +55,7 @@ var _ = framework.IngressNginxDescribe("X-Forwarded headers", func() {
|
|||
})
|
||||
|
||||
resp, body, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("X-Forwarded-Port", "1234").
|
||||
Set("X-Forwarded-Proto", "myproto").
|
||||
|
|
@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("X-Forwarded headers", func() {
|
|||
|
||||
f.UpdateNginxConfigMapData(setting, "false")
|
||||
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil))
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil))
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
|
|
@ -84,7 +84,7 @@ var _ = framework.IngressNginxDescribe("X-Forwarded headers", func() {
|
|||
})
|
||||
|
||||
resp, body, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("X-Forwarded-Port", "1234").
|
||||
Set("X-Forwarded-Proto", "myproto").
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
|
|||
"nginx.ingress.kubernetes.io/configuration-snippet": configSnippet,
|
||||
}
|
||||
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations))
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations))
|
||||
|
||||
f.WaitForNginxConfiguration(
|
||||
func(cfg string) bool {
|
||||
|
|
@ -71,7 +71,7 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
|
|||
// Should be blocked
|
||||
usIP := "8.8.8.8"
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("X-Forwarded-For", usIP).
|
||||
End()
|
||||
|
|
@ -81,7 +81,7 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
|
|||
// Shouldn't be blocked
|
||||
australianIP := "1.1.1.1"
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("X-Forwarded-For", australianIP).
|
||||
End()
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
f.NewEchoDeploymentWithReplicas(1)
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil))
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil))
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
|||
// This test works for minikube, but may have problems with real kubernetes clusters,
|
||||
// especially if connection is done via Internet. In this case, the test should be disabled/removed.
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
|
|
@ -71,7 +71,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
|||
|
||||
// Should be blocked
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36").
|
||||
End()
|
||||
|
|
@ -79,7 +79,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
|||
Expect(resp.StatusCode).Should(Equal(http.StatusForbidden))
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("User-Agent", "AlphaBot").
|
||||
End()
|
||||
|
|
@ -88,7 +88,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
|||
|
||||
// Shouldn't be blocked
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1").
|
||||
End()
|
||||
|
|
@ -107,7 +107,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
|||
|
||||
// Should be blocked
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("Referer", "example.com").
|
||||
End()
|
||||
|
|
@ -115,7 +115,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
|||
Expect(resp.StatusCode).Should(Equal(http.StatusForbidden))
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("Referer", "qwerty").
|
||||
End()
|
||||
|
|
@ -124,7 +124,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
|||
|
||||
// Shouldn't be blocked
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
Set("Referer", "qwerty123").
|
||||
End()
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
annotations := map[string]string{
|
||||
"kubernetes.io/ingress.class": "testclass",
|
||||
}
|
||||
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
||||
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, "http-svc", 80, &annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
validHost := "bar"
|
||||
ing = framework.NewSingleIngress(validHost, "/", validHost, f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
ing = framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxConfiguration(func(cfg string) bool {
|
||||
|
|
@ -58,14 +58,14 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", invalidHost).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", validHost).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
|
|
@ -75,12 +75,12 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
|
||||
Context("With a specific ingress-class", func() {
|
||||
BeforeEach(func() {
|
||||
framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
||||
framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||
func(deployment *appsv1beta1.Deployment) error {
|
||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||
args = append(args, "--ingress-class=testclass")
|
||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||
|
||||
return err
|
||||
})
|
||||
|
|
@ -89,14 +89,14 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
It("should ignore Ingress with no class", func() {
|
||||
invalidHost := "bar"
|
||||
|
||||
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.IngressController.Namespace, "http-svc", 80, nil)
|
||||
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, "http-svc", 80, nil)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
validHost := "foo"
|
||||
annotations := map[string]string{
|
||||
"kubernetes.io/ingress.class": "testclass",
|
||||
}
|
||||
ing = framework.NewSingleIngress(validHost, "/", validHost, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
||||
ing = framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, "http-svc", 80, &annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(validHost, func(cfg string) bool {
|
||||
|
|
@ -108,14 +108,14 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", validHost).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", invalidHost).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
|
|
@ -127,7 +127,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
annotations := map[string]string{
|
||||
"kubernetes.io/ingress.class": "testclass",
|
||||
}
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||
ing = f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host, func(cfg string) bool {
|
||||
|
|
@ -135,7 +135,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
|
|
@ -149,7 +149,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
|||
})
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
End()
|
||||
Expect(errs).To(BeNil())
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() {
|
|||
BeforeEach(func() {
|
||||
f.NewEchoDeployment()
|
||||
|
||||
s := f.EnsureSecret(buildSecret(username, password, secretName, f.IngressController.Namespace))
|
||||
s := f.EnsureSecret(buildSecret(username, password, secretName, f.Namespace))
|
||||
|
||||
f.UpdateNginxConfigMapData(setting, noAuthPath)
|
||||
|
||||
bi := buildBasicAuthIngressWithSecondPath(host, f.IngressController.Namespace, s.Name, noAuthPath)
|
||||
bi := buildBasicAuthIngressWithSecondPath(host, f.Namespace, s.Name, noAuthPath)
|
||||
f.EnsureIngress(bi)
|
||||
})
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() {
|
|||
})
|
||||
|
||||
resp, body, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", host).
|
||||
SetBasicAuth(username, password).
|
||||
End()
|
||||
|
|
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(fmt.Sprintf("%s/noauth", f.IngressController.HTTPURL)).
|
||||
Get(fmt.Sprintf("%s/noauth", f.GetURL(framework.HTTP))).
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ var _ = framework.IngressNginxDescribe("[Serial] Pod Security Policies", func()
|
|||
Expect(err).NotTo(HaveOccurred(), "updating ingress controller cluster role to use a pod security policy")
|
||||
|
||||
// update the deployment just to trigger a rolling update and the use of the security policy
|
||||
err = framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
||||
err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||
func(deployment *appsv1beta1.Deployment) error {
|
||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||
args = append(args, "--v=2")
|
||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||
|
||||
return err
|
||||
})
|
||||
|
|
@ -108,7 +108,7 @@ var _ = framework.IngressNginxDescribe("[Serial] Pod Security Policies", func()
|
|||
})
|
||||
|
||||
resp, _, _ := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Set("Host", "foo.bar.com").
|
||||
End()
|
||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
|
@ -37,11 +38,11 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
|||
})
|
||||
|
||||
It("should exist a proxy_host", func() {
|
||||
upstreamName := fmt.Sprintf("%v-http-svc-80", f.IngressController.Namespace)
|
||||
upstreamName := fmt.Sprintf("%v-http-svc-80", f.Namespace)
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
|
||||
}
|
||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.IngressController.Namespace, "http-svc", 80, &annotations))
|
||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, "http-svc", 80, &annotations))
|
||||
|
||||
f.WaitForNginxConfiguration(
|
||||
func(server string) bool {
|
||||
|
|
@ -50,7 +51,8 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||
Set("Host", test).
|
||||
End()
|
||||
|
||||
|
|
@ -60,13 +62,13 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
|||
})
|
||||
|
||||
It("should exist a proxy_host using the upstream-vhost annotation value", func() {
|
||||
upstreamName := fmt.Sprintf("%v-http-svc-80", f.IngressController.Namespace)
|
||||
upstreamName := fmt.Sprintf("%v-http-svc-80", f.Namespace)
|
||||
upstreamVHost := "different.host"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/upstream-vhost": upstreamVHost,
|
||||
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
|
||||
}
|
||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.IngressController.Namespace, "http-svc", 80, &annotations))
|
||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, "http-svc", 80, &annotations))
|
||||
|
||||
f.WaitForNginxConfiguration(
|
||||
func(server string) bool {
|
||||
|
|
@ -75,7 +77,8 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPURL).
|
||||
Get(f.GetURL(framework.HTTP)).
|
||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||
Set("Host", test).
|
||||
End()
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
|
|
@ -47,7 +46,7 @@ var _ = framework.IngressNginxDescribe("Proxy Protocol", func() {
|
|||
|
||||
f.UpdateNginxConfigMapData(setting, "true")
|
||||
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil))
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil))
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
|
|
@ -56,11 +55,9 @@ var _ = framework.IngressNginxDescribe("Proxy Protocol", func() {
|
|||
})
|
||||
|
||||
ip := f.GetNginxIP()
|
||||
port, err := f.GetNginxPort("http")
|
||||
Expect(err).NotTo(HaveOccurred(), "unexpected error obtaning NGINX Port")
|
||||
|
||||
conn, err := net.Dial("tcp", net.JoinHostPort(ip, strconv.Itoa(port)))
|
||||
Expect(err).NotTo(HaveOccurred(), "unexpected error creating connection to %s:%d", ip, port)
|
||||
conn, err := net.Dial("tcp", net.JoinHostPort(ip, "80"))
|
||||
Expect(err).NotTo(HaveOccurred(), "unexpected error creating connection to %s:80", ip)
|
||||
defer conn.Close()
|
||||
|
||||
header := "PROXY TCP4 192.168.0.1 192.168.0.11 56324 1234\r\n"
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ var _ = framework.IngressNginxDescribe("Server Tokens", func() {
|
|||
It("should not exists Server header in the response", func() {
|
||||
f.UpdateNginxConfigMapData(serverTokens, "false")
|
||||
|
||||
f.EnsureIngress(framework.NewSingleIngress(serverTokens, "/", serverTokens, f.IngressController.Namespace, "http-svc", 80, nil))
|
||||
f.EnsureIngress(framework.NewSingleIngress(serverTokens, "/", serverTokens, f.Namespace, "http-svc", 80, nil))
|
||||
|
||||
f.WaitForNginxConfiguration(
|
||||
func(cfg string) bool {
|
||||
|
|
@ -56,7 +56,7 @@ var _ = framework.IngressNginxDescribe("Server Tokens", func() {
|
|||
f.EnsureIngress(&v1beta1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: serverTokens,
|
||||
Namespace: f.IngressController.Namespace,
|
||||
Namespace: f.Namespace,
|
||||
Annotations: map[string]string{},
|
||||
},
|
||||
Spec: v1beta1.IngressSpec{
|
||||
|
|
|
|||
|
|
@ -54,14 +54,14 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
// https://www.openssl.org/docs/man1.1.0/apps/ciphers.html - "CIPHER SUITE NAMES"
|
||||
testCiphers := "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA"
|
||||
|
||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||
ing.Spec.TLS[0].Hosts,
|
||||
ing.Spec.TLS[0].SecretName,
|
||||
ing.Namespace)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
framework.WaitForTLS(f.IngressController.HTTPSURL, tlsConfig)
|
||||
framework.WaitForTLS(f.GetURL(framework.HTTPS), tlsConfig)
|
||||
|
||||
By("setting cipher suite")
|
||||
f.UpdateNginxConfigMapData(sslCiphers, testCiphers)
|
||||
|
|
@ -72,7 +72,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPSURL).
|
||||
Get(f.GetURL(framework.HTTPS)).
|
||||
TLSClientConfig(tlsConfig).
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
|
@ -91,7 +91,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
})
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPSURL).
|
||||
Get(f.GetURL(framework.HTTPS)).
|
||||
TLSClientConfig(tlsConfig).
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
|
@ -107,14 +107,14 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
hstsIncludeSubdomains := "hsts-include-subdomains"
|
||||
hstsPreload := "hsts-preload"
|
||||
|
||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||
ing.Spec.TLS[0].Hosts,
|
||||
ing.Spec.TLS[0].SecretName,
|
||||
ing.Namespace)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
framework.WaitForTLS(f.IngressController.HTTPSURL, tlsConfig)
|
||||
framework.WaitForTLS(f.GetURL(framework.HTTPS), tlsConfig)
|
||||
|
||||
By("setting max-age parameter")
|
||||
f.UpdateNginxConfigMapData(hstsMaxAge, "86400")
|
||||
|
|
@ -125,7 +125,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.IngressController.HTTPSURL).
|
||||
Get(f.GetURL(framework.HTTPS)).
|
||||
TLSClientConfig(tlsConfig).
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
|
@ -143,7 +143,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
})
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPSURL).
|
||||
Get(f.GetURL(framework.HTTPS)).
|
||||
TLSClientConfig(tlsConfig).
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
|
@ -161,7 +161,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
})
|
||||
|
||||
resp, _, errs = gorequest.New().
|
||||
Get(f.IngressController.HTTPSURL).
|
||||
Get(f.GetURL(framework.HTTPS)).
|
||||
TLSClientConfig(tlsConfig).
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
|
@ -172,14 +172,14 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
})
|
||||
|
||||
It("should not use ports during the HTTP to HTTPS redirection", func() {
|
||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||
ing.Spec.TLS[0].Hosts,
|
||||
ing.Spec.TLS[0].SecretName,
|
||||
ing.Namespace)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
framework.WaitForTLS(f.IngressController.HTTPSURL, tlsConfig)
|
||||
framework.WaitForTLS(f.GetURL(framework.HTTPS), tlsConfig)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
|
|
@ -188,7 +188,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(fmt.Sprintf(f.IngressController.HTTPURL)).
|
||||
Get(fmt.Sprintf(f.GetURL(framework.HTTP))).
|
||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||
RedirectPolicy(noRedirectPolicyFunc).
|
||||
Set("Host", host).
|
||||
|
|
@ -202,14 +202,14 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
It("should not use ports or X-Forwarded-Host during the HTTP to HTTPS redirection", func() {
|
||||
f.UpdateNginxConfigMapData("use-forwarded-headers", "true")
|
||||
|
||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||
ing.Spec.TLS[0].Hosts,
|
||||
ing.Spec.TLS[0].SecretName,
|
||||
ing.Namespace)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
framework.WaitForTLS(f.IngressController.HTTPSURL, tlsConfig)
|
||||
framework.WaitForTLS(f.GetURL(framework.HTTPS), tlsConfig)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
|
|
@ -218,7 +218,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
|||
})
|
||||
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(fmt.Sprintf(f.IngressController.HTTPURL)).
|
||||
Get(fmt.Sprintf(f.GetURL(framework.HTTP))).
|
||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||
RedirectPolicy(noRedirectPolicyFunc).
|
||||
Set("Host", host).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue