Refactor e2e tests to use the service ClusterIP

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-02-22 11:03:42 -03:00
parent f04361cc06
commit 5e249d3366
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
80 changed files with 777 additions and 706 deletions

View file

@ -51,7 +51,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -61,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -81,7 +81,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -91,7 +91,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -105,7 +105,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -121,7 +121,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-hash": "sha1",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -131,7 +131,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -151,7 +151,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
}
ing := framework.NewSingleIngress(host, "/something", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -161,7 +161,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/something").
Get(f.GetURL(framework.HTTP)+"/something").
Set("Host", host).
End()
@ -180,7 +180,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
f.EnsureIngress(&v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: host,
Namespace: f.IngressController.Namespace,
Namespace: f.Namespace,
Annotations: annotations,
},
Spec: v1beta1.IngressSpec{
@ -219,7 +219,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/something").
Get(f.GetURL(framework.HTTP)+"/something").
Set("Host", host).
End()
@ -228,7 +228,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring("Path=/something;"))
resp, _, errs = gorequest.New().
Get(f.IngressController.HTTPURL+"/somewhereelese").
Get(f.GetURL(framework.HTTP)+"/somewhereelese").
Set("Host", host).
End()
@ -246,7 +246,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-max-age": "259200",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -256,15 +256,19 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
Expect(errs).Should(BeEmpty())
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
local, _ := time.LoadLocation("GMT")
local, err := time.LoadLocation("GMT")
Expect(err).ToNot(HaveOccurred())
Expect(local).ShouldNot(BeNil())
duration, _ := time.ParseDuration("48h")
expected := time.Now().In(local).Add(duration).Format("Mon, 02-Jan-06 15:04")
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring(fmt.Sprintf("Expires=%s", expected)))
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring("Max-Age=259200"))
})
@ -278,7 +282,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-path": "/foo/bar",
}
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -288,7 +292,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar").
Set("Host", host).
End()
@ -310,7 +314,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/use-regex": "true",
}
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -320,7 +324,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar").
Set("Host", host).
End()
@ -338,10 +342,10 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
annotations := map[string]string{
"nginx.ingress.kubernetes.io/affinity": "cookie",
}
ing1 := framework.NewSingleIngress("ingress1", "/foo/bar", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing1 := framework.NewSingleIngress("ingress1", "/foo/bar", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing1)
ing2 := framework.NewSingleIngress("ingress2", "/foo", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
ing2 := framework.NewSingleIngress("ingress2", "/foo", host, f.Namespace, "http-svc", 80, &map[string]string{})
f.EnsureIngress(ing2)
f.WaitForNginxServer(host,
@ -351,7 +355,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo").
Get(f.GetURL(framework.HTTP)+"/foo").
Set("Host", host).
End()
@ -360,7 +364,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
Expect(resp.Header.Get("Set-Cookie")).Should(Equal(""))
resp, _, errs = gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar").
Set("Host", host).
End()

View file

@ -41,7 +41,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -50,7 +50,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
})
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -59,7 +59,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
Expect(body).Should(ContainSubstring(fmt.Sprintf("host=%v", host)))
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", "bar").
End()
@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
"nginx.ingress.kubernetes.io/server-alias": "bar",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -85,7 +85,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
hosts := []string{"foo", "bar"}
for _, host := range hosts {
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()

View file

@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Approot", func() {
"nginx.ingress.kubernetes.io/app-root": "/foo",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Approot", func() {
})
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
RedirectPolicy(noRedirectPolicyFunc).
Set("Host", host).

View file

@ -46,7 +46,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
It("should return status code 200 when no authentication is configured", func() {
host := "auth"
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("Annotations - Auth", func() {
})
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
End()
@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -82,7 +82,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
})
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
End()
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
It("should return status code 401 when authentication is configured but Authorization header is not configured", func() {
host := "auth"
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.IngressController.Namespace))
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.Namespace))
annotations := map[string]string{
"nginx.ingress.kubernetes.io/auth-type": "basic",
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -112,7 +112,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
})
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
End()
@ -125,7 +125,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
It("should return status code 401 when authentication is configured and Authorization header is sent with invalid credentials", func() {
host := "auth"
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.IngressController.Namespace))
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.Namespace))
annotations := map[string]string{
"nginx.ingress.kubernetes.io/auth-type": "basic",
@ -133,7 +133,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -142,7 +142,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
})
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
SetBasicAuth("user", "pass").
@ -156,7 +156,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
It("should return status code 200 when authentication is configured and Authorization header is sent", func() {
host := "auth"
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.IngressController.Namespace))
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.Namespace))
annotations := map[string]string{
"nginx.ingress.kubernetes.io/auth-type": "basic",
@ -164,7 +164,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -173,7 +173,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
})
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
SetBasicAuth("foo", "bar").
@ -190,7 +190,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
&corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Namespace: f.IngressController.Namespace,
Namespace: f.Namespace,
},
Data: map[string][]byte{
// invalid content
@ -206,7 +206,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -215,7 +215,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
})
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
SetBasicAuth("foo", "bar").
@ -234,7 +234,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
proxy_set_header My-Custom-Header 42;`,
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -251,7 +251,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
proxy_set_header My-Custom-Header 42;`,
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -268,10 +268,10 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
var httpbinIP string
err := framework.WaitForEndpoints(f.KubeClientSet, framework.DefaultTimeout, "httpbin", f.IngressController.Namespace, 1)
err := framework.WaitForEndpoints(f.KubeClientSet, framework.DefaultTimeout, "httpbin", f.Namespace, 1)
Expect(err).NotTo(HaveOccurred())
e, err := f.KubeClientSet.CoreV1().Endpoints(f.IngressController.Namespace).Get("httpbin", metav1.GetOptions{})
e, err := f.KubeClientSet.CoreV1().Endpoints(f.Namespace).Get("httpbin", metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
httpbinIP = e.Subsets[0].Addresses[0].IP
@ -281,7 +281,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-signin": "http://$host/auth/start",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host, func(server string) bool {
@ -291,7 +291,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
It("should return status code 200 when signed in", func() {
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
SetBasicAuth("user", "password").
@ -305,7 +305,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
It("should redirect to signin url when not signed in", func() {
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
RedirectPolicy(func(req gorequest.Request, via []gorequest.Request) error {

View file

@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
It("should set valid auth-tls-secret", func() {
host := "authtls.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
clientConfig, err := framework.CreateIngressMASecret(
f.KubeClientSet,
@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
req := gorequest.New()
uri := "/"
resp, _, errs := req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
Set("Host", host).
End()
@ -85,7 +85,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
// Send Request Passing the Client Certs
resp, _, errs = req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(clientConfig).
Set("Host", host).
End()
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
It("should set valid auth-tls-secret, sslVerify to off, and sslVerifyDepth to 2", func() {
host := "authtls.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
_, err := framework.CreateIngressMASecret(
f.KubeClientSet,
@ -129,7 +129,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
req := gorequest.New()
uri := "/"
resp, _, errs := req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
Set("Host", host).
End()
@ -139,7 +139,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
It("should set valid auth-tls-secret, pass certificate to upstream, and error page", func() {
host := "authtls.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
errorPath := "/error"
@ -152,7 +152,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
annotations := map[string]string{
"nginx.ingress.kubernetes.io/auth-tls-secret": nameSpace + "/" + host,
"nginx.ingress.kubernetes.io/auth-tls-error-page": f.IngressController.HTTPURL + errorPath,
"nginx.ingress.kubernetes.io/auth-tls-error-page": f.GetURL(framework.HTTP) + errorPath,
"nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream": "true",
}
@ -165,7 +165,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
sslVerify := "ssl_verify_client on;"
sslVerifyDepth := "ssl_verify_depth 1;"
sslErrorPage := fmt.Sprintf("error_page 495 496 = %s;", f.IngressController.HTTPURL+errorPath)
sslErrorPage := fmt.Sprintf("error_page 495 496 = %s;", f.GetURL(framework.HTTP)+errorPath)
sslUpstreamClientCert := "proxy_set_header ssl-client-cert $ssl_client_escaped_cert;"
f.WaitForNginxServer(host,
@ -183,18 +183,18 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
req := gorequest.New()
uri := "/"
resp, _, errs := req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
Set("Host", host).
RedirectPolicy(noRedirectPolicyFunc).
End()
Expect(errs).Should(BeEmpty())
Expect(resp.StatusCode).Should(Equal(http.StatusFound))
Expect(resp.Header.Get("Location")).Should(Equal(f.IngressController.HTTPURL + errorPath))
Expect(resp.Header.Get("Location")).Should(Equal(f.GetURL(framework.HTTP) + errorPath))
// Send Request Passing the Client Certs
resp, _, errs = req.
Get(f.IngressController.HTTPSURL+uri).
Get(f.GetURL(framework.HTTPS)+uri).
TLSClientConfig(clientConfig).
Set("Host", host).
End()

View file

@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "HTTPS",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -68,7 +68,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "GRPCS",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -83,7 +83,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "AJP",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -48,7 +48,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -63,14 +63,14 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -90,7 +90,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -98,7 +98,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
time.Sleep(waitForLuaSync)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "always").
End()
@ -115,7 +115,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -130,7 +130,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -141,7 +141,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
f.NewEchoDeploymentWithReplicas(0)
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "always").
End()
@ -155,7 +155,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
f.NewDeployment("http-svc-canary", "gcr.io/kubernetes-e2e-test-images/echoserver:2.2", 8080, 0)
resp, _, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "never").
End()
@ -169,7 +169,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -184,7 +184,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -192,7 +192,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests destined for the mainline ingress to the maineline upstream")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "never").
End()
@ -205,7 +205,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests destined for the canary ingress to the canary upstream")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "always").
End()
@ -225,7 +225,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -233,7 +233,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -243,7 +243,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests destined for the mainline ingress to the mainelin upstream")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "never").
End()
@ -256,7 +256,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests destined for the canary ingress to the canary upstream")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "always").
End()
@ -270,7 +270,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -285,7 +285,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -295,7 +295,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"foo": "bar",
}
modIng := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &modAnnotations)
modIng := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &modAnnotations)
f.EnsureIngress(modIng)
@ -307,7 +307,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests destined fro the mainline ingress to the mainline upstream")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "never").
End()
@ -320,7 +320,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests destined for the canary ingress to the canary upstream")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "always").
End()
@ -334,7 +334,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -349,7 +349,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -360,7 +360,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader2",
}
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary", 80, &modCanaryAnnotations)
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary", 80, &modCanaryAnnotations)
f.EnsureIngress(modCanaryIng)
time.Sleep(waitForLuaSync)
@ -368,7 +368,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests destined for the mainline ingress to the mainline upstream")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader2", "never").
End()
@ -381,7 +381,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests destined for the canary ingress to the canary upstream")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader2", "always").
End()
@ -397,7 +397,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -412,7 +412,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -421,7 +421,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the canary upstream when header is set to 'always'")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "always").
End()
@ -433,7 +433,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the mainline upstream when header is set to 'never'")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "never").
End()
@ -446,7 +446,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the mainline upstream when header is set to anything else")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "badheadervalue").
End()
@ -463,7 +463,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -479,7 +479,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -488,7 +488,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the canary upstream when header is set to 'DoCanary'")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "DoCanary").
End()
@ -500,7 +500,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the mainline upstream when header is set to 'always'")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "always").
End()
@ -513,7 +513,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the mainline upstream when header is set to 'never'")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "never").
End()
@ -526,7 +526,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the mainline upstream when header is set to anything else")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "otherheadervalue").
End()
@ -543,7 +543,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -560,7 +560,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -568,7 +568,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the canary upstream when header value does not match and cookie is set to 'always'")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
Set("CanaryByHeader", "otherheadervalue").
AddCookie(&http.Cookie{Name: "CanaryByCookie", Value: "always"}).
@ -585,7 +585,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -600,7 +600,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -608,7 +608,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the canary upstream when cookie is set to 'always'")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "always"}).
End()
@ -620,7 +620,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the mainline upstream when cookie is set to 'never'")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "never"}).
End()
@ -633,7 +633,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("routing requests to the mainline upstream when cookie is set to anything else")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "badcookievalue"}).
End()
@ -651,7 +651,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -666,7 +666,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
80, &canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -675,7 +675,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
By("returning requests from the mainline only when weight is equal to 0")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -691,14 +691,14 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"nginx.ingress.kubernetes.io/canary-weight": "100",
}
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary", 80, &modCanaryAnnotations)
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary", 80, &modCanaryAnnotations)
f.EnsureIngress(modCanaryIng)
time.Sleep(waitForLuaSync)
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -718,16 +718,16 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
}
ing := framework.NewSingleCatchAllIngress(canaryIngName, f.IngressController.Namespace, "http-svc-canary", 80, &annotations)
ing := framework.NewSingleCatchAllIngress(canaryIngName, f.Namespace, "http-svc-canary", 80, &annotations)
f.EnsureIngress(ing)
ing = framework.NewSingleCatchAllIngress(host, f.IngressController.Namespace, "http-svc", 80, nil)
ing = framework.NewSingleCatchAllIngress(host, f.Namespace, "http-svc", 80, nil)
f.EnsureIngress(ing)
f.WaitForNginxServer("_",
func(server string) bool {
upstreamName := fmt.Sprintf(`set $proxy_upstream_name "%s-%s-%s";`, f.IngressController.Namespace, "http-svc", "80")
canaryUpstreamName := fmt.Sprintf(`set $proxy_upstream_name "%s-%s-%s";`, f.IngressController.Namespace, "http-svc-canary", "80")
upstreamName := fmt.Sprintf(`set $proxy_upstream_name "%s-%s-%s";`, f.Namespace, "http-svc", "80")
canaryUpstreamName := fmt.Sprintf(`set $proxy_upstream_name "%s-%s-%s";`, f.Namespace, "http-svc-canary", "80")
return Expect(server).Should(ContainSubstring(`set $ingress_name "`+host+`";`)) &&
Expect(server).ShouldNot(ContainSubstring(`set $proxy_upstream_name "upstream-default-backend";`)) &&
Expect(server).ShouldNot(ContainSubstring(canaryUpstreamName)) &&
@ -743,11 +743,11 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
}
ing := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary", 80, &annotations)
ing := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary", 80, &annotations)
f.EnsureIngress(ing)
otherHost := "bar"
ing = framework.NewSingleIngress(otherHost, "/", otherHost, f.IngressController.Namespace, "http-svc", 80, nil)
ing = framework.NewSingleIngress(otherHost, "/", otherHost, f.Namespace, "http-svc", 80, nil)
f.EnsureIngress(ing)
time.Sleep(waitForLuaSync)

View file

@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1000",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1K",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -68,7 +68,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1k",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -83,7 +83,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1m",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -98,7 +98,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1M",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -113,7 +113,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1b",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Connection", func() {
"nginx.ingress.kubernetes.io/connection-proxy-header": "keep-alive",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -52,7 +52,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Connection", func() {
})
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
End()

View file

@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
"nginx.ingress.kubernetes.io/enable-cors": "true",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -72,7 +72,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
uri := "/"
resp, _, errs := gorequest.New().
Options(f.IngressController.HTTPURL+uri).
Options(f.GetURL(framework.HTTP)+uri).
Set("Host", host).
End()
Expect(errs).Should(BeEmpty())
@ -86,7 +86,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
"nginx.ingress.kubernetes.io/cors-allow-methods": "POST, GET",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -102,7 +102,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
"nginx.ingress.kubernetes.io/cors-max-age": "200",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -118,7 +118,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
"nginx.ingress.kubernetes.io/cors-allow-credentials": "false",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -134,7 +134,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
"nginx.ingress.kubernetes.io/cors-allow-origin": "https://origin.cors.com:8080",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -150,7 +150,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
"nginx.ingress.kubernetes.io/cors-allow-headers": "DNT, User-Agent",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -47,7 +47,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func(
"nginx.ingress.kubernetes.io/custom-http-errors": strings.Join(errorCodes, ","),
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
var serverConfig string
@ -70,7 +70,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func(
}
By("updating configuration when only custom-http-error value changes")
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.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/custom-http-errors"] = "503"
return nil
})
@ -88,7 +88,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func(
By("ignoring duplicate values (503 in this case) per server")
annotations["nginx.ingress.kubernetes.io/custom-http-errors"] = "404, 503"
ing = framework.NewSingleIngress(fmt.Sprintf("%s-else", host), "/else", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing = framework.NewSingleIngress(fmt.Sprintf("%s-else", host), "/else", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host, func(sc string) bool {
serverConfig = sc

View file

@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom default-backend", f
"nginx.ingress.kubernetes.io/default-backend": "http-svc",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "invalid", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "invalid", 80, &annotations)
f.EnsureIngress(ing)
time.Sleep(5 * time.Second)
@ -54,7 +54,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom default-backend", f
uri := "/alma/armud"
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+uri).
Get(f.GetURL(framework.HTTP)+uri).
Set("Host", host).
End()

View file

@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Forcesslredirect", func()
"nginx.ingress.kubernetes.io/force-ssl-redirect": "true",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Forcesslredirect", func()
})
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
RedirectPolicy(noRedirectPolicyFunc).
Set("Host", host).

View file

@ -47,7 +47,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
"nginx.ingress.kubernetes.io/from-to-www-redirect": "true",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxConfiguration(
@ -59,7 +59,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
By("sending request to www.fromtowwwredirect.bar.com")
resp, _, errs := gorequest.New().
Get(fmt.Sprintf("%s/%s", f.IngressController.HTTPURL, "foo")).
Get(fmt.Sprintf("%s/%s", f.GetURL(framework.HTTP), "foo")).
Retry(10, 1*time.Second, http.StatusNotFound).
RedirectPolicy(noRedirectPolicyFunc).
Set("Host", fmt.Sprintf("%s.%s", "www", host)).
@ -78,7 +78,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
"nginx.ingress.kubernetes.io/from-to-www-redirect": "true",
}
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host, fmt.Sprintf("www.%v", host)}, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host, fmt.Sprintf("www.%v", host)}, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
@ -90,7 +90,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
f.WaitForNginxServer(fmt.Sprintf("www.%v", host),
func(server string) bool {
return Expect(server).Should(ContainSubstring(`server_name www.fromtowwwredirect.bar.com;`)) &&
Expect(server).Should(ContainSubstring(fmt.Sprintf("/etc/ingress-controller/ssl/%v-fromtowwwredirect.bar.com.pem", f.IngressController.Namespace))) &&
Expect(server).Should(ContainSubstring(fmt.Sprintf("/etc/ingress-controller/ssl/%v-fromtowwwredirect.bar.com.pem", f.Namespace))) &&
Expect(server).Should(ContainSubstring(`return 308 $scheme://fromtowwwredirect.bar.com$request_uri;`))
})
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
InsecureSkipVerify: true,
ServerName: h,
}).
Get(f.IngressController.HTTPSURL).
Get(f.GetURL(framework.HTTPS)).
Retry(10, 1*time.Second, http.StatusNotFound).
RedirectPolicy(noRedirectPolicyFunc).
Set("host", h).

View file

@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Annotations - grpc", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "fortune-teller", 50051, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "fortune-teller", 50051, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Annotations - HTTP2 Push Preload", func(
"nginx.ingress.kubernetes.io/http2-push-preload": "true",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -67,7 +67,7 @@ var _ = framework.IngressNginxDescribe("Annotations - influxdb", func() {
// Do a request to the echo server ingress that sends metrics
// to the InfluxDB backend.
res, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
@ -103,7 +103,7 @@ func createInfluxDBService(f *framework.Framework) *corev1.Service {
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "inflxudb-svc",
Namespace: f.IngressController.Namespace,
Namespace: f.Namespace,
},
Spec: corev1.ServiceSpec{Ports: []corev1.ServicePort{
{
@ -123,7 +123,7 @@ func createInfluxDBService(f *framework.Framework) *corev1.Service {
}
func createInfluxDBIngress(f *framework.Framework, host, service string, port int, annotations map[string]string) {
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, service, port, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, service, port, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -133,7 +133,7 @@ func createInfluxDBIngress(f *framework.Framework, host, service string, port in
}
func extractInfluxDBMeasurements(f *framework.Framework) (string, error) {
l, err := f.KubeClientSet.CoreV1().Pods(f.IngressController.Namespace).List(metav1.ListOptions{
l, err := f.KubeClientSet.CoreV1().Pods(f.Namespace).List(metav1.ListOptions{
LabelSelector: "app=influxdb-svc",
})
if err != nil {

View file

@ -37,7 +37,7 @@ var _ = framework.IngressNginxDescribe("Annotations - IPWhiteList", func() {
It("should set valid ip whitelist range", func() {
host := "ipwhitelist.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
annotations := map[string]string{
"nginx.ingress.kubernetes.io/whitelist-source-range": "18.0.0.0/8, 56.0.0.0/8",

View file

@ -39,7 +39,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Log", func() {
"nginx.ingress.kubernetes.io/enable-access-log": "false",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -54,7 +54,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Log", func() {
"nginx.ingress.kubernetes.io/enable-rewrite-log": "true",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
host := "foo"
createIngress(f, host, "http-svc", 80, map[string]string{"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -55,7 +55,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
"nginx.ingress.kubernetes.io/lua-resty-waf": "active",
"nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets": "41000_sqli, 42000_xss"})
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -70,7 +70,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
"nginx.ingress.kubernetes.io/lua-resty-waf": "active",
"nginx.ingress.kubernetes.io/lua-resty-waf-score-threshold": "20"})
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -86,7 +86,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
"nginx.ingress.kubernetes.io/lua-resty-waf-allow-unknown-content-types": "true",
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
url := fmt.Sprintf("%s?msg=my-message", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=my-message", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
"nginx.ingress.kubernetes.io/lua-resty-waf-process-multipart-body": "false",
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
url := fmt.Sprintf("%s?msg=my-message", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=my-message", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -119,7 +119,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
createIngress(f, host, "http-svc", 80, map[string]string{
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
url := fmt.Sprintf("%s?msg=my-message", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=my-message", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -148,7 +148,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
]=]`,
})
url := fmt.Sprintf("%s?msg=my-message", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=my-message", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -157,7 +157,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
Expect(len(errs)).Should(Equal(0))
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
url = fmt.Sprintf("%s?msg=my-foo-message", f.IngressController.HTTPURL)
url = fmt.Sprintf("%s?msg=my-foo-message", f.GetURL(framework.HTTP))
resp, _, errs = gorequest.New().
Get(url).
Set("Host", host).
@ -172,7 +172,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
host := "foo"
createIngress(f, host, "http-svc", 80, map[string]string{})
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -185,7 +185,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
host := "foo"
createIngress(f, host, "http-svc", 80, map[string]string{"nginx.ingress.kubernetes.io/lua-resty-waf": "simulate"})
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
resp, _, errs := gorequest.New().
Get(url).
Set("Host", host).
@ -203,7 +203,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
})
func createIngress(f *framework.Framework, host, service string, port int, annotations map[string]string) {
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, service, port, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, service, port, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -214,7 +214,7 @@ func createIngress(f *framework.Framework, host, service string, port int, annot
time.Sleep(1 * time.Second)
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()

View file

@ -35,7 +35,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
It("should enable modsecurity", func() {
host := "modsecurity.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
annotations := map[string]string{
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
It("should enable modsecurity with transaction ID and OWASP rules", func() {
host := "modsecurity.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
annotations := map[string]string{
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
It("should disable modsecurity", func() {
host := "modsecurity.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
annotations := map[string]string{
"nginx.ingress.kubernetes.io/enable-modsecurity": "false",
@ -91,7 +91,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
It("should enable modsecurity with snippet", func() {
host := "modsecurity.foo.com"
nameSpace := f.IngressController.Namespace
nameSpace := f.Namespace
annotations := map[string]string{
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",

View file

@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -57,7 +57,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -72,7 +72,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -86,7 +86,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-body-size": "8m",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -100,7 +100,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-body-size": "15r",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -116,7 +116,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-read-timeout": "20",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -134,7 +134,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-read-timeout": "20k",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -151,7 +151,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-buffer-size": "8k",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -168,7 +168,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-request-buffering": "off",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -183,7 +183,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-next-upstream-tries": "5",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -199,7 +199,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-cookie-path": "/one/ /",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -52,7 +52,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
annotations := map[string]string{"nginx.ingress.kubernetes.io/permanent-redirect": redirectURL}
ing := framework.NewSingleIngress(host, redirectPath, host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, redirectPath, host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -64,7 +64,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
By("sending request to redirected URL path")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+redirectPath).
Get(f.GetURL(framework.HTTP)+redirectPath).
Set("Host", host).
RedirectPolicy(noRedirectPolicyFunc).
End()
@ -88,7 +88,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
"nginx.ingress.kubernetes.io/permanent-redirect-code": strconv.Itoa(redirectCode),
}
ing := framework.NewSingleIngress(host, redirectPath, host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, redirectPath, host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -100,7 +100,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
By("sending request to redirected URL path")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+redirectPath).
Get(f.GetURL(framework.HTTP)+redirectPath).
Set("Host", host).
RedirectPolicy(noRedirectPolicyFunc).
End()

View file

@ -47,7 +47,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/enable-rewrite-log": "true",
}
ing := framework.NewSingleIngress(host, "/something", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -56,7 +56,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
})
resp, _, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/something").
Get(f.GetURL(framework.HTTP)+"/something").
Set("Host", host).
End()
@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
host := "rewrite.bar.com"
By("creating a regular ingress definition")
ing := framework.NewSingleIngress("kube-lego", "/.well-known/acme/challenge", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
ing := framework.NewSingleIngress("kube-lego", "/.well-known/acme/challenge", host, f.Namespace, "http-svc", 80, &map[string]string{})
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -83,7 +83,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("making a request to the non-rewritten location")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/.well-known/acme/challenge").
Get(f.GetURL(framework.HTTP)+"/.well-known/acme/challenge").
Set("Host", host).
End()
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/.well-known/acme/challenge", host)
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
annotations := map[string]string{
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
}
rewriteIng := framework.NewSingleIngress("rewrite-index", "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
rewriteIng := framework.NewSingleIngress("rewrite-index", "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(rewriteIng)
@ -106,7 +106,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("making a second request to the non-rewritten location")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL+"/.well-known/acme/challenge").
Get(f.GetURL(framework.HTTP)+"/.well-known/acme/challenge").
Set("Host", host).
End()
Expect(len(errs)).Should(Equal(0))
@ -118,7 +118,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
host := "rewrite.bar.com"
By("creating a regular ingress definition")
ing := framework.NewSingleIngress("foo", "/foo", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
ing := framework.NewSingleIngress("foo", "/foo", host, f.Namespace, "http-svc", 80, &map[string]string{})
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -131,7 +131,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/use-regex": "true",
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
}
ing = framework.NewSingleIngress("regex", "/foo.+", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing = framework.NewSingleIngress("regex", "/foo.+", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -141,7 +141,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("ensuring '/foo' matches '~* ^/foo'")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo").
Get(f.GetURL(framework.HTTP)+"/foo").
Set("Host", host).
End()
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/foo", host)
@ -151,7 +151,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("ensuring '/foo/bar' matches '~* ^/foo.+'")
resp, body, errs = gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar").
Set("Host", host).
End()
expectBodyRequestURI = fmt.Sprintf("request_uri=http://%v:8080/new/backend", host)
@ -164,7 +164,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
host := "rewrite.bar.com"
By("creating a regular ingress definition")
ing := framework.NewSingleIngress("foo", "/foo/bar/bar", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
ing := framework.NewSingleIngress("foo", "/foo/bar/bar", host, f.Namespace, "http-svc", 80, &map[string]string{})
f.EnsureIngress(ing)
By(`creating an ingress definition with the use-regex annotation`)
@ -172,7 +172,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/use-regex": "true",
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
}
ing = framework.NewSingleIngress("regex", "/foo/bar/[a-z]{3}", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing = framework.NewSingleIngress("regex", "/foo/bar/[a-z]{3}", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -182,7 +182,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("check that '/foo/bar/bar' does not match the longest exact path")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar/bar").
Set("Host", host).
End()
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/new/backend", host)
@ -199,7 +199,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/use-regex": "true",
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend/$1",
}
ing := framework.NewSingleIngress("regex", "/foo/bar/(.+)", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress("regex", "/foo/bar/(.+)", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -209,7 +209,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
By("check that '/foo/bar/bar' redirects to cusotm rewrite")
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL+"/foo/bar/bar").
Get(f.GetURL(framework.HTTP)+"/foo/bar/bar").
Set("Host", host).
End()
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/new/backend/bar", host)

View file

@ -58,11 +58,11 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() {
annotationKey: "all",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &initAnnotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &initAnnotations)
f.EnsureIngress(ing)
for key, result := range results {
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.ObjectMeta.Annotations[annotationKey] = annotations[key]
return nil
})
@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() {
})
resp, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Retry(10, 1*time.Second, http.StatusNotFound).
Set("Host", host).
End()

View file

@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ServerSnippet", func() {
more_set_headers "Content-Type: $content_type";`,
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -39,7 +39,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Configurationsnippet", fun
more_set_headers "Request-Id: $req_id";`,
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -39,7 +39,7 @@ var _ = framework.IngressNginxDescribe("Annotations - SSL CIPHERS", func() {
"nginx.ingress.kubernetes.io/ssl-ciphers": "ALL:!aNULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP",
}
ing := framework.NewSingleIngress(host, "/something", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -33,7 +33,7 @@ import (
func startIngress(f *framework.Framework, annotations *map[string]string) map[string]bool {
host := "upstream-hash-by.foo.com"
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
func(server string) bool {
@ -42,7 +42,7 @@ func startIngress(f *framework.Framework, annotations *map[string]string) map[st
err := wait.PollImmediate(framework.Poll, framework.DefaultTimeout, func() (bool, error) {
resp, _, _ := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()
if resp.StatusCode == http.StatusOK {
@ -57,7 +57,7 @@ func startIngress(f *framework.Framework, annotations *map[string]string) map[st
for i := 0; i < 100; i++ {
_, body, errs := gorequest.New().
Get(f.IngressController.HTTPURL).
Get(f.GetURL(framework.HTTP)).
Set("Host", host).
End()

View file

@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Upstreamvhost", func() {
"nginx.ingress.kubernetes.io/upstream-vhost": "upstreamvhost.bar.com",
}
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,