Remove hard-coded annotation and don't use map pointers

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-12-13 02:47:11 -03:00
parent c2550930b1
commit 5c30820d1f
43 changed files with 179 additions and 173 deletions

View file

@ -39,6 +39,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
"k8s.io/ingress-nginx/internal/ingress"
"k8s.io/ingress-nginx/internal/ingress/annotations/class"
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
"k8s.io/ingress-nginx/internal/k8s"
"k8s.io/ingress-nginx/test/e2e/framework"
@ -216,7 +217,7 @@ func TestStore(t *testing.T) {
Name: "custom-class",
Namespace: ns,
Annotations: map[string]string{
"kubernetes.io/ingress.class": "something",
class.IngressKey: "something",
},
},
Spec: networking.IngressSpec{
@ -331,7 +332,7 @@ func TestStore(t *testing.T) {
Name: "custom-class",
Namespace: ns,
Annotations: map[string]string{
"kubernetes.io/ingress.class": "something",
class.IngressKey: "something",
},
},
Spec: networking.IngressSpec{
@ -874,7 +875,7 @@ func TestListIngresses(t *testing.T) {
Name: "test-2",
Namespace: "testns",
Annotations: map[string]string{
"kubernetes.io/ingress.class": "something",
class.IngressKey: "something",
},
CreationTimestamp: metav1.NewTime(time.Now()),
},
@ -924,7 +925,7 @@ func TestListIngresses(t *testing.T) {
Name: "test-4",
Namespace: "testns",
Annotations: map[string]string{
"kubernetes.io/ingress.class": "nginx",
class.IngressKey: "nginx",
},
CreationTimestamp: metav1.NewTime(time.Now()),
},

View file

@ -50,7 +50,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -116,7 +116,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
}
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -211,7 +211,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-max-age": "259200",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -247,7 +247,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/session-cookie-path": "/foo/bar",
}
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -275,7 +275,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
"nginx.ingress.kubernetes.io/use-regex": "true",
}
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -303,10 +303,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.Namespace, framework.EchoService, 80, &annotations)
ing1 := framework.NewSingleIngress("ingress1", "/foo/bar", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing1)
ing2 := framework.NewSingleIngress("ingress2", "/foo", host, f.Namespace, framework.EchoService, 80, &map[string]string{})
ing2 := framework.NewSingleIngress("ingress2", "/foo", host, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing2)
f.WaitForNginxServer(host,

View file

@ -41,7 +41,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
"nginx.ingress.kubernetes.io/server-alias": "bar",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -133,7 +133,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -164,7 +164,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -195,7 +195,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -237,7 +237,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -265,7 +265,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
proxy_set_header My-Custom-Header 42;`,
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -282,7 +282,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
proxy_set_header My-Custom-Header 42;`,
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -303,7 +303,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"My-Custom-Header": "42",
})
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -321,7 +321,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-cache-duration": "200 202 401 30m",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -353,7 +353,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
"nginx.ingress.kubernetes.io/auth-signin": "http://$host/auth/start",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host, func(server string) bool {
@ -424,14 +424,14 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
for _, host := range []string{thisHost, thatHost} {
By("Adding an ingress rule for /foo")
fooIng := framework.NewSingleIngress(fmt.Sprintf("foo-%s-ing", host), fooPath, host, f.Namespace, framework.EchoService, 80, &annotations)
fooIng := framework.NewSingleIngress(fmt.Sprintf("foo-%s-ing", host), fooPath, host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(fooIng)
f.WaitForNginxServer(host, func(server string) bool {
return Expect(server).Should(ContainSubstring("location /foo"))
})
By("Adding an ingress rule for /bar")
barIng := framework.NewSingleIngress(fmt.Sprintf("bar-%s-ing", host), barPath, host, f.Namespace, framework.EchoService, 80, &annotations)
barIng := framework.NewSingleIngress(fmt.Sprintf("bar-%s-ing", host), barPath, host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(barIng)
f.WaitForNginxServer(host, func(server string) bool {
return Expect(server).Should(ContainSubstring("location /bar"))

View file

@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
"nginx.ingress.kubernetes.io/auth-tls-secret": nameSpace + "/" + host,
}
f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, nameSpace, framework.EchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, nameSpace, framework.EchoService, 80, annotations))
assertSslClientCertificateConfig(f, host, "on", "1")
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
"nginx.ingress.kubernetes.io/auth-tls-verify-depth": "2",
}
f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, nameSpace, framework.EchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, nameSpace, framework.EchoService, 80, annotations))
assertSslClientCertificateConfig(f, host, "off", "2")
@ -130,7 +130,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
"nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream": "true",
}
f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, nameSpace, framework.EchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, nameSpace, framework.EchoService, 80, annotations))
assertSslClientCertificateConfig(f, host, "on", "1")

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -83,7 +83,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "FCGI",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -98,7 +98,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "AJP",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -50,7 +50,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -65,7 +65,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, &canaryAnnotations)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -92,7 +92,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
@ -116,7 +116,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -132,7 +132,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -170,7 +170,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -186,7 +186,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -227,14 +227,14 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -271,7 +271,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -287,7 +287,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -296,7 +296,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"foo": "bar",
}
modIng := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &modAnnotations)
modIng := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, modAnnotations)
f.EnsureIngress(modIng)
@ -335,7 +335,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -351,7 +351,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -361,7 +361,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader2",
}
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, &modCanaryAnnotations)
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, modCanaryAnnotations)
f.EnsureIngress(modCanaryIng)
time.Sleep(waitForLuaSync)
@ -398,7 +398,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -414,7 +414,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -464,7 +464,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -481,7 +481,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -544,7 +544,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -562,7 +562,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -586,7 +586,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -602,7 +602,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -652,7 +652,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -668,7 +668,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService,
80, &canaryAnnotations)
80, canaryAnnotations)
f.EnsureIngress(canaryIng)
time.Sleep(waitForLuaSync)
@ -692,7 +692,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"nginx.ingress.kubernetes.io/canary-weight": "100",
}
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, &modCanaryAnnotations)
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, modCanaryAnnotations)
f.EnsureIngress(modCanaryIng)
@ -719,7 +719,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
}
ing := framework.NewSingleCatchAllIngress(canaryIngName, f.Namespace, canaryService, 80, &annotations)
ing := framework.NewSingleCatchAllIngress(canaryIngName, f.Namespace, canaryService, 80, annotations)
f.EnsureIngress(ing)
ing = framework.NewSingleCatchAllIngress(host, f.Namespace, framework.EchoService, 80, nil)
@ -744,7 +744,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
}
ing := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, &annotations)
ing := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, canaryService, 80, annotations)
f.EnsureIngress(ing)
otherHost := "bar"
@ -769,7 +769,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
}
paths := []string{"/foo", "/bar"}
ing := framework.NewSingleIngressWithMultiplePaths(canaryIngName, paths, host, f.Namespace, "httpy-svc-canary", 80, &annotations)
ing := framework.NewSingleIngressWithMultiplePaths(canaryIngName, paths, host, f.Namespace, "httpy-svc-canary", 80, annotations)
f.EnsureIngress(ing)
ing = framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, nil)

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -50,7 +50,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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
var serverConfig string
@ -91,7 +91,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.Namespace, framework.EchoService, 80, &annotations)
ing = framework.NewSingleIngress(fmt.Sprintf("%s-else", host), "/else", host, f.Namespace, framework.EchoService, 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": framework.EchoService,
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "invalid", 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "invalid", 80, annotations)
f.EnsureIngress(ing)
time.Sleep(5 * time.Second)

View file

@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - FastCGI", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "FCGI",
}
ing := framework.NewSingleIngress(host, "/hello", host, f.Namespace, "fastcgi-helloserver", 9000, &annotations)
ing := framework.NewSingleIngress(host, "/hello", host, f.Namespace, "fastcgi-helloserver", 9000, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -60,7 +60,7 @@ var _ = framework.IngressNginxDescribe("Annotations - FastCGI", func() {
"nginx.ingress.kubernetes.io/fastcgi-index": "index.php",
}
ing := framework.NewSingleIngress(host, "/hello", host, f.Namespace, "fastcgi-helloserver", 9000, &annotations)
ing := framework.NewSingleIngress(host, "/hello", host, f.Namespace, "fastcgi-helloserver", 9000, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -92,7 +92,7 @@ var _ = framework.IngressNginxDescribe("Annotations - FastCGI", func() {
"nginx.ingress.kubernetes.io/fastcgi-params-configmap": "fastcgi-configmap",
}
ing := framework.NewSingleIngress(host, "/hello", host, f.Namespace, "fastcgi-helloserver", 9000, &annotations)
ing := framework.NewSingleIngress(host, "/hello", host, f.Namespace, "fastcgi-helloserver", 9000, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -110,7 +110,7 @@ var _ = framework.IngressNginxDescribe("Annotations - FastCGI", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "FCGI",
}
ing := framework.NewSingleIngress(host, path, host, f.Namespace, "fastcgi-helloserver", 9000, &annotations)
ing := framework.NewSingleIngress(host, path, host, f.Namespace, "fastcgi-helloserver", 9000, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
resp, _, errs := gorequest.New().

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxConfiguration(
@ -81,7 +81,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
"nginx.ingress.kubernetes.io/configuration-snippet": "more_set_headers \"ExpectedHost: $http_host\";",
}
ing := framework.NewSingleIngressWithTLS(fromHost, "/", fromHost, []string{fromHost, toHost}, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngressWithTLS(fromHost, "/", fromHost, []string{fromHost, toHost}, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,

View file

@ -48,7 +48,7 @@ var _ = framework.IngressNginxDescribe("Annotations - GRPC", func() {
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "fortune-teller", 50051, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "fortune-teller", 50051, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -87,7 +87,7 @@ var _ = framework.IngressNginxDescribe("Annotations - GRPC", func() {
}
f.EnsureService(svc)
annotations := &map[string]string{
annotations := map[string]string{
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
}
@ -143,7 +143,7 @@ var _ = framework.IngressNginxDescribe("Annotations - GRPC", func() {
}
f.EnsureService(svc)
annotations := &map[string]string{
annotations := map[string]string{
"nginx.ingress.kubernetes.io/backend-protocol": "GRPCS",
"nginx.ingress.kubernetes.io/configuration-snippet": `
# without this setting NGINX sends echo instead

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -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.Namespace, service, port, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, service, port, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - IPWhiteList", func() {
"nginx.ingress.kubernetes.io/whitelist-source-range": "18.0.0.0/8, 56.0.0.0/8",
}
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Mirror", func() {
"nginx.ingress.kubernetes.io/mirror-uri": "/mirror",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -55,7 +55,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Mirror", func() {
"nginx.ingress.kubernetes.io/mirror-request-body": "off",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -41,7 +41,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
}
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -61,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
"nginx.ingress.kubernetes.io/modsecurity-transaction-id": "modsecurity-$request_id",
}
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -80,7 +80,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
"nginx.ingress.kubernetes.io/enable-modsecurity": "false",
}
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -98,7 +98,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
"nginx.ingress.kubernetes.io/modsecurity-snippet": "SecRuleEngine On",
}
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, nameSpace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -152,7 +152,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-buffer-size": "8k",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -169,7 +169,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-request-buffering": "off",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -185,7 +185,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-next-upstream-tries": "5",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -198,7 +198,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
It("should build proxy next upstream using configmap values", func() {
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.SetNginxConfigMapData(map[string]string{
@ -221,7 +221,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-cookie-path": "/one/ /",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -236,7 +236,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
"nginx.ingress.kubernetes.io/proxy-http-version": "1.0",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -44,7 +44,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ProxySSL", func() {
_, err := framework.CreateIngressMASecret(f.KubeClientSet, host, host, f.Namespace)
Expect(err).ToNot(HaveOccurred())
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
assertProxySSL(f, host, "DEFAULT", "TLSv1 TLSv1.1 TLSv1.2", "off", 1)
@ -61,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ProxySSL", func() {
_, err := framework.CreateIngressMASecret(f.KubeClientSet, host, host, f.Namespace)
Expect(err).ToNot(HaveOccurred())
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
assertProxySSL(f, host, "DEFAULT", "TLSv1 TLSv1.1 TLSv1.2", "on", 2)
@ -77,7 +77,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ProxySSL", func() {
_, err := framework.CreateIngressMASecret(f.KubeClientSet, host, host, f.Namespace)
Expect(err).ToNot(HaveOccurred())
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
assertProxySSL(f, host, "HIGH:!AES", "TLSv1 TLSv1.1 TLSv1.2", "off", 1)
@ -93,7 +93,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ProxySSL", func() {
_, err := framework.CreateIngressMASecret(f.KubeClientSet, host, host, f.Namespace)
Expect(err).ToNot(HaveOccurred())
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
assertProxySSL(f, host, "DEFAULT", "TLSv1.2 TLSv1.3", "off", 1)

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, redirectPath, host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, redirectPath, host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -48,7 +48,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
"nginx.ingress.kubernetes.io/enable-rewrite-log": "true",
}
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -74,7 +74,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.Namespace, framework.EchoService, 80, &map[string]string{})
ing := framework.NewSingleIngress("kube-lego", "/.well-known/acme/challenge", host, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -96,7 +96,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.Namespace, framework.EchoService, 80, &annotations)
rewriteIng := framework.NewSingleIngress("rewrite-index", "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(rewriteIng)
@ -119,7 +119,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
host := "rewrite.bar.com"
By("creating a regular ingress definition")
ing := framework.NewSingleIngress("foo", "/foo", host, f.Namespace, framework.EchoService, 80, &map[string]string{})
ing := framework.NewSingleIngress("foo", "/foo", host, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -132,7 +132,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.Namespace, framework.EchoService, 80, &annotations)
ing = framework.NewSingleIngress("regex", "/foo.+", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -165,7 +165,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.Namespace, framework.EchoService, 80, &map[string]string{})
ing := framework.NewSingleIngress("foo", "/foo/bar/bar", host, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
By(`creating an ingress definition with the use-regex annotation`)
@ -173,7 +173,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.Namespace, framework.EchoService, 80, &annotations)
ing = framework.NewSingleIngress("regex", "/foo/bar/[a-z]{3}", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
@ -200,7 +200,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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress("regex", "/foo/bar/(.+)", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -58,7 +58,7 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() {
annotationKey: "all",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &initAnnotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, initAnnotations)
f.EnsureIngress(ing)
for key, result := range results {
@ -116,7 +116,7 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() {
"nginx.ingress.kubernetes.io/satisfy": "any",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host, func(server string) bool {

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -30,7 +30,7 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
func startIngress(f *framework.Framework, annotations *map[string]string) map[string]bool {
func startIngress(f *framework.Framework, annotations map[string]string) map[string]bool {
host := "upstream-hash-by.foo.com"
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
@ -87,7 +87,7 @@ var _ = framework.IngressNginxDescribe("Annotations - UpstreamHashBy", func() {
"nginx.ingress.kubernetes.io/upstream-hash-by": "$request_uri",
}
podMap := startIngress(f, &annotations)
podMap := startIngress(f, annotations)
Expect(len(podMap)).Should(Equal(1))
})
@ -99,7 +99,7 @@ var _ = framework.IngressNginxDescribe("Annotations - UpstreamHashBy", func() {
"nginx.ingress.kubernetes.io/upstream-hash-by-subset-size": "3",
}
podMap := startIngress(f, &annotations)
podMap := startIngress(f, annotations)
Expect(len(podMap)).Should(Equal(3))
})

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.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,

View file

@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - X-Forwarded-Prefix", func(
"nginx.ingress.kubernetes.io/rewrite-target": "/foo",
}
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations))
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring("proxy_set_header X-Forwarded-Prefix \"/test/value\";"))
@ -66,7 +66,7 @@ var _ = framework.IngressNginxDescribe("Annotations - X-Forwarded-Prefix", func(
"nginx.ingress.kubernetes.io/rewrite-target": "/foo",
}
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations))
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(And(ContainSubstring(host), Not(ContainSubstring("proxy_set_header X-Forwarded-Prefix"))))

View file

@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Debug Tool", func() {
It("should list the backend servers", func() {
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxConfiguration(func(cfg string) bool {
@ -60,7 +60,7 @@ var _ = framework.IngressNginxDescribe("Debug Tool", func() {
It("should get information for a specific backend server", func() {
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxConfiguration(func(cfg string) bool {
@ -89,7 +89,7 @@ var _ = framework.IngressNginxDescribe("Debug Tool", func() {
It("should produce valid JSON for /dbg general", func() {
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
cmd := "/dbg general"

View file

@ -407,17 +407,17 @@ func UpdateIngress(kubeClientSet kubernetes.Interface, namespace string, name st
}
// NewSingleIngressWithTLS creates a simple ingress rule with TLS spec included
func NewSingleIngressWithTLS(name, path, host string, tlsHosts []string, ns, service string, port int, annotations *map[string]string) *networking.Ingress {
func NewSingleIngressWithTLS(name, path, host string, tlsHosts []string, ns, service string, port int, annotations map[string]string) *networking.Ingress {
return newSingleIngressWithRules(name, path, host, ns, service, port, annotations, tlsHosts)
}
// NewSingleIngress creates a simple ingress rule
func NewSingleIngress(name, path, host, ns, service string, port int, annotations *map[string]string) *networking.Ingress {
func NewSingleIngress(name, path, host, ns, service string, port int, annotations map[string]string) *networking.Ingress {
return newSingleIngressWithRules(name, path, host, ns, service, port, annotations, nil)
}
// NewSingleIngressWithMultiplePaths creates a simple ingress rule with multiple paths
func NewSingleIngressWithMultiplePaths(name string, paths []string, host, ns, service string, port int, annotations *map[string]string) *networking.Ingress {
func NewSingleIngressWithMultiplePaths(name string, paths []string, host, ns, service string, port int, annotations map[string]string) *networking.Ingress {
spec := networking.IngressSpec{
Rules: []networking.IngressRule{
{
@ -442,7 +442,7 @@ func NewSingleIngressWithMultiplePaths(name string, paths []string, host, ns, se
return newSingleIngress(name, ns, annotations, spec)
}
func newSingleIngressWithRules(name, path, host, ns, service string, port int, annotations *map[string]string, tlsHosts []string) *networking.Ingress {
func newSingleIngressWithRules(name, path, host, ns, service string, port int, annotations map[string]string, tlsHosts []string) *networking.Ingress {
spec := networking.IngressSpec{
Rules: []networking.IngressRule{
@ -478,7 +478,7 @@ func newSingleIngressWithRules(name, path, host, ns, service string, port int, a
}
// NewSingleIngressWithBackendAndRules creates an ingress with both a default backend and a rule
func NewSingleIngressWithBackendAndRules(name, path, host, ns, defaultService string, defaultPort int, service string, port int, annotations *map[string]string) *networking.Ingress {
func NewSingleIngressWithBackendAndRules(name, path, host, ns, defaultService string, defaultPort int, service string, port int, annotations map[string]string) *networking.Ingress {
spec := networking.IngressSpec{
Backend: &networking.IngressBackend{
ServiceName: defaultService,
@ -508,7 +508,7 @@ func NewSingleIngressWithBackendAndRules(name, path, host, ns, defaultService st
}
// NewSingleCatchAllIngress creates a simple ingress with a catch-all backend
func NewSingleCatchAllIngress(name, ns, service string, port int, annotations *map[string]string) *networking.Ingress {
func NewSingleCatchAllIngress(name, ns, service string, port int, annotations map[string]string) *networking.Ingress {
spec := networking.IngressSpec{
Backend: &networking.IngressBackend{
ServiceName: service,
@ -518,19 +518,19 @@ func NewSingleCatchAllIngress(name, ns, service string, port int, annotations *m
return newSingleIngress(name, ns, annotations, spec)
}
func newSingleIngress(name, ns string, annotations *map[string]string, spec networking.IngressSpec) *networking.Ingress {
func newSingleIngress(name, ns string, annotations map[string]string, spec networking.IngressSpec) *networking.Ingress {
if annotations == nil {
annotations = &map[string]string{}
annotations = make(map[string]string)
}
ing := &networking.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: ns,
Annotations: *annotations,
Name: name,
Namespace: ns,
},
Spec: spec,
}
ing.SetAnnotations(annotations)
return ing
}

View file

@ -81,7 +81,7 @@ var _ = framework.IngressNginxDescribe("Shutdown ingress controller", func() {
"nginx.ingress.kubernetes.io/proxy-send-timeout": "600",
"nginx.ingress.kubernetes.io/proxy-read-timeout": "600",
}
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.SlowEchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.SlowEchoService, 80, annotations))
f.WaitForNginxServer(host,
func(server string) bool {
@ -139,7 +139,7 @@ var _ = framework.IngressNginxDescribe("Shutdown ingress controller", func() {
"nginx.ingress.kubernetes.io/proxy-send-timeout": "600",
"nginx.ingress.kubernetes.io/proxy-read-timeout": "600",
}
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.SlowEchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.SlowEchoService, 80, annotations))
f.WaitForNginxServer(host,
func(server string) bool {

View file

@ -194,7 +194,10 @@ func ensureIngress(f *framework.Framework, host string, deploymentName string) *
func createIngress(f *framework.Framework, host string, deploymentName string) *networking.Ingress {
ing := f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, deploymentName, 80,
&map[string]string{"nginx.ingress.kubernetes.io/load-balance": "ewma"}))
map[string]string{
"nginx.ingress.kubernetes.io/load-balance": "ewma",
},
))
f.WaitForNginxServer(host,
func(server string) bool {

View file

@ -61,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
"nginx.ingress.kubernetes.io/configuration-snippet": configSnippet,
}
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations))
f.WaitForNginxConfiguration(
func(cfg string) bool {

View file

@ -125,7 +125,7 @@ var _ = framework.IngressNginxDescribe("Global External Auth", func() {
annotations := map[string]string{
enableGlobalExternalAuthAnnotation: "false",
}
barIng := framework.NewSingleIngress("bar-ingress", barPath, host, f.Namespace, echoServiceName, 80, &annotations)
barIng := framework.NewSingleIngress("bar-ingress", barPath, host, f.Namespace, echoServiceName, 80, annotations)
f.EnsureIngress(barIng)
f.WaitForNginxServer(host,
func(server string) bool {

View file

@ -26,6 +26,7 @@ import (
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/ingress-nginx/internal/ingress/annotations/class"
"k8s.io/ingress-nginx/test/e2e/framework"
)
@ -44,9 +45,9 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
It("should ignore Ingress with class", func() {
invalidHost := "foo"
annotations := map[string]string{
"kubernetes.io/ingress.class": "testclass",
class.IngressKey: "testclass",
}
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
validHost := "bar"
@ -76,7 +77,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
Context("With a specific ingress-class", func() {
BeforeEach(func() {
framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
func(deployment *appsv1.Deployment) error {
args := deployment.Spec.Template.Spec.Containers[0].Args
args = append(args, "--ingress-class=testclass")
@ -85,6 +86,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
return err
})
Expect(err).To(BeNil())
})
It("should ignore Ingress with no class", func() {
@ -95,9 +97,9 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
validHost := "foo"
annotations := map[string]string{
"kubernetes.io/ingress.class": "testclass",
class.IngressKey: "testclass",
}
ing = framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, framework.EchoService, 80, &annotations)
ing = framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(validHost, func(cfg string) bool {
@ -126,10 +128,10 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
It("should delete Ingress when class is removed", func() {
host := "foo"
annotations := map[string]string{
"kubernetes.io/ingress.class": "testclass",
class.IngressKey: "testclass",
}
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
ing = f.EnsureIngress(ing)
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host, func(cfg string) bool {
return strings.Contains(cfg, "server_name foo")
@ -145,8 +147,9 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
Expect(err).To(BeNil())
delete(ing.Annotations, "kubernetes.io/ingress.class")
f.EnsureIngress(ing)
delete(ing.Annotations, class.IngressKey)
_, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(ing.Namespace).Update(ing)
Expect(err).To(BeNil())
f.WaitForNginxConfiguration(func(cfg string) bool {
return !strings.Contains(cfg, "server_name foo")
@ -160,5 +163,4 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
})
})
})

View file

@ -118,7 +118,7 @@ var _ = framework.IngressNginxDescribe("Listen on nondefault ports", func() {
"nginx.ingress.kubernetes.io/auth-signin": "http://$host/auth/start",
}
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, &annotations)
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,

View file

@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
annotations := map[string]string{
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
}
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, framework.EchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, framework.EchoService, 80, annotations))
f.WaitForNginxConfiguration(
func(server string) bool {
@ -68,7 +68,7 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
"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.Namespace, framework.EchoService, 80, &annotations))
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, framework.EchoService, 80, annotations))
f.WaitForNginxConfiguration(
func(server string) bool {