From 5c30820d1f11bc3d42941d54fcc781e65f5e2406 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Fri, 13 Dec 2019 02:47:11 -0300 Subject: [PATCH] Remove hard-coded annotation and don't use map pointers --- .../ingress/controller/store/store_test.go | 9 +-- test/e2e/annotations/affinity.go | 16 ++--- test/e2e/annotations/alias.go | 4 +- test/e2e/annotations/approot.go | 2 +- test/e2e/annotations/auth.go | 26 ++++----- test/e2e/annotations/authtls.go | 6 +- test/e2e/annotations/backendprotocol.go | 10 ++-- test/e2e/annotations/canary.go | 58 +++++++++---------- test/e2e/annotations/clientbodybuffersize.go | 12 ++-- test/e2e/annotations/connection.go | 2 +- test/e2e/annotations/cors.go | 12 ++-- test/e2e/annotations/customhttperrors.go | 4 +- test/e2e/annotations/default_backend.go | 2 +- test/e2e/annotations/fastcgi.go | 8 +-- test/e2e/annotations/forcesslredirect.go | 2 +- test/e2e/annotations/fromtowwwredirect.go | 4 +- test/e2e/annotations/grpc.go | 6 +- test/e2e/annotations/http2pushpreload.go | 2 +- test/e2e/annotations/influxdb.go | 2 +- test/e2e/annotations/ipwhitelist.go | 2 +- test/e2e/annotations/log.go | 4 +- test/e2e/annotations/mirror.go | 4 +- test/e2e/annotations/modsecurity.go | 8 +-- test/e2e/annotations/proxy.go | 26 ++++----- test/e2e/annotations/proxyssl.go | 8 +-- test/e2e/annotations/redirect.go | 4 +- test/e2e/annotations/rewrite.go | 16 ++--- test/e2e/annotations/satisfy.go | 4 +- test/e2e/annotations/serversnippet.go | 2 +- test/e2e/annotations/snippet.go | 2 +- test/e2e/annotations/sslciphers.go | 2 +- test/e2e/annotations/upstreamhashby.go | 6 +- test/e2e/annotations/upstreamvhost.go | 2 +- test/e2e/annotations/xforwardedprefix.go | 4 +- test/e2e/dbg/main.go | 6 +- test/e2e/framework/framework.go | 22 +++---- test/e2e/gracefulshutdown/shutdown.go | 4 +- test/e2e/lua/dynamic_configuration.go | 5 +- test/e2e/settings/geoip2.go | 2 +- test/e2e/settings/global_external_auth.go | 2 +- test/e2e/settings/ingress_class.go | 24 ++++---- test/e2e/settings/listen_nondefault_ports.go | 2 +- test/e2e/settings/proxy_host.go | 4 +- 43 files changed, 179 insertions(+), 173 deletions(-) diff --git a/internal/ingress/controller/store/store_test.go b/internal/ingress/controller/store/store_test.go index e3d58c62b..0ac5019a1 100644 --- a/internal/ingress/controller/store/store_test.go +++ b/internal/ingress/controller/store/store_test.go @@ -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()), }, diff --git a/test/e2e/annotations/affinity.go b/test/e2e/annotations/affinity.go index cbafb9861..c786b2af7 100644 --- a/test/e2e/annotations/affinity.go +++ b/test/e2e/annotations/affinity.go @@ -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, diff --git a/test/e2e/annotations/alias.go b/test/e2e/annotations/alias.go index f1a87a0b1..188387fbe 100644 --- a/test/e2e/annotations/alias.go +++ b/test/e2e/annotations/alias.go @@ -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, diff --git a/test/e2e/annotations/approot.go b/test/e2e/annotations/approot.go index e331c7985..53bd181f1 100644 --- a/test/e2e/annotations/approot.go +++ b/test/e2e/annotations/approot.go @@ -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, diff --git a/test/e2e/annotations/auth.go b/test/e2e/annotations/auth.go index 0ea417726..ce927907b 100644 --- a/test/e2e/annotations/auth.go +++ b/test/e2e/annotations/auth.go @@ -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")) diff --git a/test/e2e/annotations/authtls.go b/test/e2e/annotations/authtls.go index 8a69d27f0..350e21a92 100644 --- a/test/e2e/annotations/authtls.go +++ b/test/e2e/annotations/authtls.go @@ -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") diff --git a/test/e2e/annotations/backendprotocol.go b/test/e2e/annotations/backendprotocol.go index a0ab446fc..c7e13d958 100644 --- a/test/e2e/annotations/backendprotocol.go +++ b/test/e2e/annotations/backendprotocol.go @@ -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, diff --git a/test/e2e/annotations/canary.go b/test/e2e/annotations/canary.go index 2fa8eb238..c630eec92 100644 --- a/test/e2e/annotations/canary.go +++ b/test/e2e/annotations/canary.go @@ -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) diff --git a/test/e2e/annotations/clientbodybuffersize.go b/test/e2e/annotations/clientbodybuffersize.go index 2c52faf42..58d368004 100644 --- a/test/e2e/annotations/clientbodybuffersize.go +++ b/test/e2e/annotations/clientbodybuffersize.go @@ -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, diff --git a/test/e2e/annotations/connection.go b/test/e2e/annotations/connection.go index 1fcde61ec..906624ca9 100644 --- a/test/e2e/annotations/connection.go +++ b/test/e2e/annotations/connection.go @@ -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, diff --git a/test/e2e/annotations/cors.go b/test/e2e/annotations/cors.go index bfb65cb83..d75b2f4f0 100644 --- a/test/e2e/annotations/cors.go +++ b/test/e2e/annotations/cors.go @@ -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, diff --git a/test/e2e/annotations/customhttperrors.go b/test/e2e/annotations/customhttperrors.go index c925a520a..b7c84b7c8 100644 --- a/test/e2e/annotations/customhttperrors.go +++ b/test/e2e/annotations/customhttperrors.go @@ -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 diff --git a/test/e2e/annotations/default_backend.go b/test/e2e/annotations/default_backend.go index b5e3b08ab..f05240190 100644 --- a/test/e2e/annotations/default_backend.go +++ b/test/e2e/annotations/default_backend.go @@ -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) diff --git a/test/e2e/annotations/fastcgi.go b/test/e2e/annotations/fastcgi.go index a7c9e937f..4a01987d6 100644 --- a/test/e2e/annotations/fastcgi.go +++ b/test/e2e/annotations/fastcgi.go @@ -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, diff --git a/test/e2e/annotations/forcesslredirect.go b/test/e2e/annotations/forcesslredirect.go index 085df6cd9..b4823d98c 100644 --- a/test/e2e/annotations/forcesslredirect.go +++ b/test/e2e/annotations/forcesslredirect.go @@ -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(). diff --git a/test/e2e/annotations/fromtowwwredirect.go b/test/e2e/annotations/fromtowwwredirect.go index 3f0452a22..3ec45a5e5 100644 --- a/test/e2e/annotations/fromtowwwredirect.go +++ b/test/e2e/annotations/fromtowwwredirect.go @@ -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, diff --git a/test/e2e/annotations/grpc.go b/test/e2e/annotations/grpc.go index 10bb7d4b6..225471d50 100644 --- a/test/e2e/annotations/grpc.go +++ b/test/e2e/annotations/grpc.go @@ -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 diff --git a/test/e2e/annotations/http2pushpreload.go b/test/e2e/annotations/http2pushpreload.go index cc5d94d76..56c9c8151 100644 --- a/test/e2e/annotations/http2pushpreload.go +++ b/test/e2e/annotations/http2pushpreload.go @@ -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, diff --git a/test/e2e/annotations/influxdb.go b/test/e2e/annotations/influxdb.go index ed131718d..bfdecff5a 100644 --- a/test/e2e/annotations/influxdb.go +++ b/test/e2e/annotations/influxdb.go @@ -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, diff --git a/test/e2e/annotations/ipwhitelist.go b/test/e2e/annotations/ipwhitelist.go index d6cad5344..385268046 100644 --- a/test/e2e/annotations/ipwhitelist.go +++ b/test/e2e/annotations/ipwhitelist.go @@ -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, diff --git a/test/e2e/annotations/log.go b/test/e2e/annotations/log.go index a702f3eb1..d29c1eca4 100644 --- a/test/e2e/annotations/log.go +++ b/test/e2e/annotations/log.go @@ -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, diff --git a/test/e2e/annotations/mirror.go b/test/e2e/annotations/mirror.go index 6816f6964..f38731d6b 100644 --- a/test/e2e/annotations/mirror.go +++ b/test/e2e/annotations/mirror.go @@ -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, diff --git a/test/e2e/annotations/modsecurity.go b/test/e2e/annotations/modsecurity.go index 7a6771b97..8a767b967 100644 --- a/test/e2e/annotations/modsecurity.go +++ b/test/e2e/annotations/modsecurity.go @@ -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, diff --git a/test/e2e/annotations/proxy.go b/test/e2e/annotations/proxy.go index 281de3a7a..602d2dc9f 100644 --- a/test/e2e/annotations/proxy.go +++ b/test/e2e/annotations/proxy.go @@ -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, diff --git a/test/e2e/annotations/proxyssl.go b/test/e2e/annotations/proxyssl.go index e1b06483f..3020c0c83 100644 --- a/test/e2e/annotations/proxyssl.go +++ b/test/e2e/annotations/proxyssl.go @@ -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) diff --git a/test/e2e/annotations/redirect.go b/test/e2e/annotations/redirect.go index 4009b9f7d..c064d8304 100644 --- a/test/e2e/annotations/redirect.go +++ b/test/e2e/annotations/redirect.go @@ -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, diff --git a/test/e2e/annotations/rewrite.go b/test/e2e/annotations/rewrite.go index fafb81ec7..8046a4010 100644 --- a/test/e2e/annotations/rewrite.go +++ b/test/e2e/annotations/rewrite.go @@ -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, diff --git a/test/e2e/annotations/satisfy.go b/test/e2e/annotations/satisfy.go index dc2cf7049..5d03e2034 100644 --- a/test/e2e/annotations/satisfy.go +++ b/test/e2e/annotations/satisfy.go @@ -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 { diff --git a/test/e2e/annotations/serversnippet.go b/test/e2e/annotations/serversnippet.go index 1a1f7f1df..a87350dbb 100644 --- a/test/e2e/annotations/serversnippet.go +++ b/test/e2e/annotations/serversnippet.go @@ -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, diff --git a/test/e2e/annotations/snippet.go b/test/e2e/annotations/snippet.go index dc029dc94..e7b034357 100644 --- a/test/e2e/annotations/snippet.go +++ b/test/e2e/annotations/snippet.go @@ -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, diff --git a/test/e2e/annotations/sslciphers.go b/test/e2e/annotations/sslciphers.go index ae8f75530..4cded2dc4 100644 --- a/test/e2e/annotations/sslciphers.go +++ b/test/e2e/annotations/sslciphers.go @@ -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, diff --git a/test/e2e/annotations/upstreamhashby.go b/test/e2e/annotations/upstreamhashby.go index 301262129..90549949b 100644 --- a/test/e2e/annotations/upstreamhashby.go +++ b/test/e2e/annotations/upstreamhashby.go @@ -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)) }) diff --git a/test/e2e/annotations/upstreamvhost.go b/test/e2e/annotations/upstreamvhost.go index dca09ed42..34e66f33e 100644 --- a/test/e2e/annotations/upstreamvhost.go +++ b/test/e2e/annotations/upstreamvhost.go @@ -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, diff --git a/test/e2e/annotations/xforwardedprefix.go b/test/e2e/annotations/xforwardedprefix.go index 872b3de42..6057e86b1 100644 --- a/test/e2e/annotations/xforwardedprefix.go +++ b/test/e2e/annotations/xforwardedprefix.go @@ -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")))) diff --git a/test/e2e/dbg/main.go b/test/e2e/dbg/main.go index 0c6e3a99a..16e678dee 100644 --- a/test/e2e/dbg/main.go +++ b/test/e2e/dbg/main.go @@ -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" diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 21d1cff50..302f73e67 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -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 } diff --git a/test/e2e/gracefulshutdown/shutdown.go b/test/e2e/gracefulshutdown/shutdown.go index 05bf15410..99dfa0448 100755 --- a/test/e2e/gracefulshutdown/shutdown.go +++ b/test/e2e/gracefulshutdown/shutdown.go @@ -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 { diff --git a/test/e2e/lua/dynamic_configuration.go b/test/e2e/lua/dynamic_configuration.go index b69bc8e7f..5f9bea019 100644 --- a/test/e2e/lua/dynamic_configuration.go +++ b/test/e2e/lua/dynamic_configuration.go @@ -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 { diff --git a/test/e2e/settings/geoip2.go b/test/e2e/settings/geoip2.go index cf9ad075c..28070a7d9 100644 --- a/test/e2e/settings/geoip2.go +++ b/test/e2e/settings/geoip2.go @@ -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 { diff --git a/test/e2e/settings/global_external_auth.go b/test/e2e/settings/global_external_auth.go index 1f8d49f2a..c944c9697 100755 --- a/test/e2e/settings/global_external_auth.go +++ b/test/e2e/settings/global_external_auth.go @@ -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 { diff --git a/test/e2e/settings/ingress_class.go b/test/e2e/settings/ingress_class.go index 0108113e9..b669503ed 100644 --- a/test/e2e/settings/ingress_class.go +++ b/test/e2e/settings/ingress_class.go @@ -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)) }) }) - }) diff --git a/test/e2e/settings/listen_nondefault_ports.go b/test/e2e/settings/listen_nondefault_ports.go index 8acb6c71b..8e6f7903e 100644 --- a/test/e2e/settings/listen_nondefault_ports.go +++ b/test/e2e/settings/listen_nondefault_ports.go @@ -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, diff --git a/test/e2e/settings/proxy_host.go b/test/e2e/settings/proxy_host.go index 7598feaf5..ca6198a62 100644 --- a/test/e2e/settings/proxy_host.go +++ b/test/e2e/settings/proxy_host.go @@ -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 {