From 0dce5be743ae012dc5b22c1cf4b91dcdb8b64d88 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Thu, 12 Dec 2019 20:12:12 -0300 Subject: [PATCH 1/7] Migrate ingress definitions from extensions to networking.k8s.io --- deploy/validating-webhook.yaml.tpl | 4 +- docs/deploy/validating-webhook.md | 4 +- docs/examples/affinity/cookie/ingress.yaml | 2 +- docs/examples/auth/basic/README.md | 2 +- docs/examples/auth/client-certs/ingress.yaml | 2 +- docs/examples/auth/external-auth/README.md | 4 +- docs/examples/auth/external-auth/ingress.yaml | 2 +- .../dashboard-ingress.yaml | 4 +- .../oauth-external-auth/oauth2-proxy.yaml | 2 +- docs/examples/chashsubset/deployment.yaml | 2 +- .../configuration-snippets/ingress.yaml | 2 +- .../deploy/auth-service.yaml | 2 +- .../deploy/echo-service.yaml | 6 +- docs/examples/docker-registry/deployment.yaml | 2 +- .../docker-registry/ingress-with-tls.yaml | 2 +- .../docker-registry/ingress-without-tls.yaml | 2 +- docs/examples/grpc/app.yaml | 2 +- docs/examples/grpc/ingress.yaml | 2 +- docs/examples/http-svc.yaml | 2 +- docs/examples/multi-tls/multi-tls.yaml | 4 +- docs/examples/rewrite/README.md | 4 +- docs/examples/static-ip/nginx-ingress.yaml | 2 +- docs/examples/tls-termination/README.md | 6 +- docs/examples/tls-termination/ingress.yaml | 4 +- docs/troubleshooting.md | 2 +- docs/user-guide/basic-usage.md | 4 +- docs/user-guide/fcgi-services.md | 2 +- docs/user-guide/ingress-path-matching.md | 12 ++-- .../nginx-configuration/annotations.md | 2 +- .../third-party-addons/opentracing.md | 4 +- internal/ingress/status/status.go | 2 +- test/e2e/annotations/affinity.go | 18 ++--- test/e2e/annotations/customhttperrors.go | 6 +- test/e2e/annotations/satisfy.go | 4 +- test/e2e/defaultbackend/with_hosts.go | 10 +-- test/e2e/framework/framework.go | 71 +++++++++---------- test/e2e/framework/k8s.go | 8 +-- test/e2e/framework/util.go | 4 +- test/e2e/leaks/lua_ssl.go | 2 +- test/e2e/lua/dynamic_certificates.go | 22 +++--- test/e2e/lua/dynamic_configuration.go | 10 +-- test/e2e/run.sh | 16 ++--- test/e2e/servicebackend/service_backend.go | 34 ++++----- test/e2e/settings/disable_catch_all.go | 6 +- test/e2e/settings/no_auth_locations.go | 20 +++--- test/e2e/settings/pod_security_policy.go | 22 +++--- .../settings/pod_security_policy_volumes.go | 2 +- test/e2e/settings/server_tokens.go | 16 ++--- test/e2e/status/update.go | 6 +- 49 files changed, 186 insertions(+), 189 deletions(-) diff --git a/deploy/validating-webhook.yaml.tpl b/deploy/validating-webhook.yaml.tpl index 7aad64f8c..b7ee80ac5 100644 --- a/deploy/validating-webhook.yaml.tpl +++ b/deploy/validating-webhook.yaml.tpl @@ -7,7 +7,7 @@ webhooks: - name: validate.nginx.ingress.kubernetes.io rules: - apiGroups: - - extensions + - networking.k8s.io apiVersions: - v1beta1 operations: @@ -20,6 +20,6 @@ webhooks: service: namespace: ingress-nginx name: nginx-ingress-webhook - path: /extensions/v1beta1/ingresses + path: /networking.k8s.io/v1beta1/ingresses caBundle: --- \ No newline at end of file diff --git a/docs/deploy/validating-webhook.md b/docs/deploy/validating-webhook.md index c083fa35e..81fd6392b 100644 --- a/docs/deploy/validating-webhook.md +++ b/docs/deploy/validating-webhook.md @@ -148,7 +148,7 @@ webhooks: - name: validate.nginx.ingress.kubernetes.io rules: - apiGroups: - - extensions + - networking.k8s.io/v1beta1 apiVersions: - v1beta1 operations: @@ -161,7 +161,7 @@ webhooks: service: namespace: ingress-nginx name: ingress-validation-webhook - path: /extensions/v1beta1/ingress + path: /networking.k8s.io/v1beta1/ingress caBundle: ``` diff --git a/docs/examples/affinity/cookie/ingress.yaml b/docs/examples/affinity/cookie/ingress.yaml index 4abebfedf..57edbdbd3 100644 --- a/docs/examples/affinity/cookie/ingress.yaml +++ b/docs/examples/affinity/cookie/ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: nginx-test diff --git a/docs/examples/auth/basic/README.md b/docs/examples/auth/basic/README.md index 15e0a7eeb..edf5ebd95 100644 --- a/docs/examples/auth/basic/README.md +++ b/docs/examples/auth/basic/README.md @@ -30,7 +30,7 @@ type: Opaque ```console echo " -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: ingress-with-auth diff --git a/docs/examples/auth/client-certs/ingress.yaml b/docs/examples/auth/client-certs/ingress.yaml index 39dacce97..cf5f701b2 100644 --- a/docs/examples/auth/client-certs/ingress.yaml +++ b/docs/examples/auth/client-certs/ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/examples/auth/external-auth/README.md b/docs/examples/auth/external-auth/README.md index d1d6011c6..a08138373 100644 --- a/docs/examples/auth/external-auth/README.md +++ b/docs/examples/auth/external-auth/README.md @@ -2,7 +2,7 @@ ### Example 1: -Use an external service (Basic Auth) located in `https://httpbin.org` +Use an external service (Basic Auth) located in `https://httpbin.org` ``` $ kubectl create -f ingress.yaml @@ -13,7 +13,7 @@ NAME HOSTS ADDRESS PORTS AGE external-auth external-auth-01.sample.com 172.17.4.99 80 13s $ kubectl get ing external-auth -o yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/examples/auth/external-auth/ingress.yaml b/docs/examples/auth/external-auth/ingress.yaml index 4cec37653..c7a87a240 100644 --- a/docs/examples/auth/external-auth/ingress.yaml +++ b/docs/examples/auth/external-auth/ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/examples/auth/oauth-external-auth/dashboard-ingress.yaml b/docs/examples/auth/oauth-external-auth/dashboard-ingress.yaml index 17a222939..ade56a9e6 100644 --- a/docs/examples/auth/oauth-external-auth/dashboard-ingress.yaml +++ b/docs/examples/auth/oauth-external-auth/dashboard-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: @@ -18,7 +18,7 @@ spec: --- -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: oauth2-proxy diff --git a/docs/examples/auth/oauth-external-auth/oauth2-proxy.yaml b/docs/examples/auth/oauth-external-auth/oauth2-proxy.yaml index 4fe0dd27b..dc5b7a354 100644 --- a/docs/examples/auth/oauth-external-auth/oauth2-proxy.yaml +++ b/docs/examples/auth/oauth-external-auth/oauth2-proxy.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: labels: diff --git a/docs/examples/chashsubset/deployment.yaml b/docs/examples/chashsubset/deployment.yaml index 5db8d3b37..9b1bafcb1 100644 --- a/docs/examples/chashsubset/deployment.yaml +++ b/docs/examples/chashsubset/deployment.yaml @@ -54,7 +54,7 @@ spec: targetPort: 8080 --- -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/examples/customization/configuration-snippets/ingress.yaml b/docs/examples/customization/configuration-snippets/ingress.yaml index 01af93ea2..07af3552f 100644 --- a/docs/examples/customization/configuration-snippets/ingress.yaml +++ b/docs/examples/customization/configuration-snippets/ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: nginx-configuration-snippet diff --git a/docs/examples/customization/external-auth-headers/deploy/auth-service.yaml b/docs/examples/customization/external-auth-headers/deploy/auth-service.yaml index af8f09518..3a5dff12c 100644 --- a/docs/examples/customization/external-auth-headers/deploy/auth-service.yaml +++ b/docs/examples/customization/external-auth-headers/deploy/auth-service.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: demo-auth-service diff --git a/docs/examples/customization/external-auth-headers/deploy/echo-service.yaml b/docs/examples/customization/external-auth-headers/deploy/echo-service.yaml index 363c4bf3d..1c3667c7c 100644 --- a/docs/examples/customization/external-auth-headers/deploy/echo-service.yaml +++ b/docs/examples/customization/external-auth-headers/deploy/echo-service.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: demo-echo-service @@ -43,7 +43,7 @@ spec: selector: k8s-app: demo-echo-service --- -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: public-demo-echo-service @@ -61,7 +61,7 @@ spec: servicePort: 80 path: / --- -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: secure-demo-echo-service diff --git a/docs/examples/docker-registry/deployment.yaml b/docs/examples/docker-registry/deployment.yaml index c9044b488..7a923d69f 100644 --- a/docs/examples/docker-registry/deployment.yaml +++ b/docs/examples/docker-registry/deployment.yaml @@ -5,7 +5,7 @@ metadata: --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: docker-registry diff --git a/docs/examples/docker-registry/ingress-with-tls.yaml b/docs/examples/docker-registry/ingress-with-tls.yaml index 817d3d85f..fc277b20f 100644 --- a/docs/examples/docker-registry/ingress-with-tls.yaml +++ b/docs/examples/docker-registry/ingress-with-tls.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/examples/docker-registry/ingress-without-tls.yaml b/docs/examples/docker-registry/ingress-without-tls.yaml index 6c89101b6..1ce1b98fb 100644 --- a/docs/examples/docker-registry/ingress-without-tls.yaml +++ b/docs/examples/docker-registry/ingress-without-tls.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/examples/grpc/app.yaml b/docs/examples/grpc/app.yaml index 04f1932d7..3c04033e0 100644 --- a/docs/examples/grpc/app.yaml +++ b/docs/examples/grpc/app.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: fortune-teller-app diff --git a/docs/examples/grpc/ingress.yaml b/docs/examples/grpc/ingress.yaml index 02174c2db..1d76476d1 100644 --- a/docs/examples/grpc/ingress.yaml +++ b/docs/examples/grpc/ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/examples/http-svc.yaml b/docs/examples/http-svc.yaml index aabe9a652..bd2b34ce9 100644 --- a/docs/examples/http-svc.yaml +++ b/docs/examples/http-svc.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: http-svc diff --git a/docs/examples/multi-tls/multi-tls.yaml b/docs/examples/multi-tls/multi-tls.yaml index f6ae876d0..c616501be 100644 --- a/docs/examples/multi-tls/multi-tls.yaml +++ b/docs/examples/multi-tls/multi-tls.yaml @@ -90,9 +90,9 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - + --- -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: foo-tls diff --git a/docs/examples/rewrite/README.md b/docs/examples/rewrite/README.md index 299b791f4..b27d75c4c 100644 --- a/docs/examples/rewrite/README.md +++ b/docs/examples/rewrite/README.md @@ -34,7 +34,7 @@ Create an Ingress rule with a rewrite annotation: ```console $ echo ' -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: @@ -65,7 +65,7 @@ For example, the ingress definition above will result in the following rewrites: Create an Ingress rule with a app-root annotation: ``` $ echo " -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/examples/static-ip/nginx-ingress.yaml b/docs/examples/static-ip/nginx-ingress.yaml index 1db6ee335..aa4877e56 100644 --- a/docs/examples/static-ip/nginx-ingress.yaml +++ b/docs/examples/static-ip/nginx-ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: ingress-nginx diff --git a/docs/examples/tls-termination/README.md b/docs/examples/tls-termination/README.md index a4e20e73b..99de6c29e 100644 --- a/docs/examples/tls-termination/README.md +++ b/docs/examples/tls-termination/README.md @@ -11,7 +11,7 @@ You need a [TLS cert](../PREREQUISITES.md#tls-certificates) and a [test HTTP ser Create a `values.yaml` file. ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: nginx-test @@ -19,7 +19,7 @@ spec: tls: - hosts: - foo.bar.com - # This assumes tls-secret exists and the SSL + # This assumes tls-secret exists and the SSL # certificate contains a CN for foo.bar.com secretName: tls-secret rules: @@ -33,7 +33,7 @@ spec: servicePort: 80 ``` -The following command instructs the controller to terminate traffic using the provided +The following command instructs the controller to terminate traffic using the provided TLS cert, and forward un-encrypted HTTP traffic to the test HTTP service. ```console diff --git a/docs/examples/tls-termination/ingress.yaml b/docs/examples/tls-termination/ingress.yaml index b5decf8f2..fc97b3707 100644 --- a/docs/examples/tls-termination/ingress.yaml +++ b/docs/examples/tls-termination/ingress.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: nginx-test @@ -6,7 +6,7 @@ spec: tls: - hosts: - foo.bar.com - # This assumes tls-secret exists and the SSL + # This assumes tls-secret exists and the SSL # certificate contains a CN for foo.bar.com secretName: tls-secret rules: diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index a99da8511..915c38aad 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -32,7 +32,7 @@ Rules: /tea tea-svc:80 () /coffee coffee-svc:80 () Annotations: - kubectl.kubernetes.io/last-applied-configuration: {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{},"name":"cafe-ingress","namespace":"default","selfLink":"/apis/networking/v1beta1/namespaces/default/ingresses/cafe-ingress"},"spec":{"rules":[{"host":"cafe.com","http":{"paths":[{"backend":{"serviceName":"tea-svc","servicePort":80},"path":"/tea"},{"backend":{"serviceName":"coffee-svc","servicePort":80},"path":"/coffee"}]}}]},"status":{"loadBalancer":{"ingress":[{"ip":"169.48.142.110"}]}}} + kubectl.kubernetes.io/last-applied-configuration: {"apiVersion":"networking.k8s.io/v1beta1","kind":"Ingress","metadata":{"annotations":{},"name":"cafe-ingress","namespace":"default","selfLink":"/apis/networking/v1beta1/namespaces/default/ingresses/cafe-ingress"},"spec":{"rules":[{"host":"cafe.com","http":{"paths":[{"backend":{"serviceName":"tea-svc","servicePort":80},"path":"/tea"},{"backend":{"serviceName":"coffee-svc","servicePort":80},"path":"/coffee"}]}}]},"status":{"loadBalancer":{"ingress":[{"ip":"169.48.142.110"}]}}} Events: Type Reason Age From Message diff --git a/docs/user-guide/basic-usage.md b/docs/user-guide/basic-usage.md index b5feca7f0..247cb8bf2 100644 --- a/docs/user-guide/basic-usage.md +++ b/docs/user-guide/basic-usage.md @@ -5,7 +5,7 @@ ingress-nginx can be used for many use cases, inside various cloud provider and First of all follow the instructions to install ingress-nginx. Then imagine that you need to expose 2 HTTP services already installed: `myServiceA`, `myServiceB`. Let's say that you want to expose the first at `myServiceA.foo.org` and the second at `myServiceB.foo.org`. One possible solution is to create two **ingress** resources: ``` -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: ingress-myServiceA @@ -22,7 +22,7 @@ spec: serviceName: myServiceA servicePort: 80 --- -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: ingress-myServiceB diff --git a/docs/user-guide/fcgi-services.md b/docs/user-guide/fcgi-services.md index fba989f3c..aa0924769 100644 --- a/docs/user-guide/fcgi-services.md +++ b/docs/user-guide/fcgi-services.md @@ -60,7 +60,7 @@ data: --- -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/user-guide/ingress-path-matching.md b/docs/user-guide/ingress-path-matching.md index ae1c1b584..09d39f4c0 100644 --- a/docs/user-guide/ingress-path-matching.md +++ b/docs/user-guide/ingress-path-matching.md @@ -2,8 +2,8 @@ ## Regular Expression Support -!!! important - Regular expressions and wild cards are not supported in the `spec.rules.host` field. Full hostnames must be used. +!!! important + Regular expressions and wild cards are not supported in the `spec.rules.host` field. Full hostnames must be used. The ingress controller supports **case insensitive** regular expressions in the `spec.rules.http.paths.path` field. This can be enabled by setting the `nginx.ingress.kubernetes.io/use-regex` annotation to `true` (the default is false). @@ -11,7 +11,7 @@ This can be enabled by setting the `nginx.ingress.kubernetes.io/use-regex` annot See the [description](./nginx-configuration/annotations.md#use-regex) of the `use-regex` annotation for more details. ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: test-ingress @@ -47,7 +47,7 @@ In NGINX, regular expressions follow a **first match** policy. In order to enabl Let the following two ingress definitions be created: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: test-ingress-1 @@ -67,7 +67,7 @@ spec: ``` ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: test-ingress-2 @@ -121,7 +121,7 @@ This case is expected and a result of NGINX's a first match policy for paths tha Let the following ingress be defined: ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: test-ingress-3 diff --git a/docs/user-guide/nginx-configuration/annotations.md b/docs/user-guide/nginx-configuration/annotations.md index 134cab0f9..3a00afa26 100755 --- a/docs/user-guide/nginx-configuration/annotations.md +++ b/docs/user-guide/nginx-configuration/annotations.md @@ -361,7 +361,7 @@ For more information please see [the `server_name` documentation](http://nginx.o Using the annotation `nginx.ingress.kubernetes.io/server-snippet` it is possible to add custom configuration in the server configuration block. ```yaml -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: diff --git a/docs/user-guide/third-party-addons/opentracing.md b/docs/user-guide/third-party-addons/opentracing.md index 13c2a1753..df8568e24 100644 --- a/docs/user-guide/third-party-addons/opentracing.md +++ b/docs/user-guide/third-party-addons/opentracing.md @@ -29,7 +29,7 @@ zipkin-collector-host: zipkin.default.svc.cluster.local jaeger-collector-host: jaeger-agent.default.svc.cluster.local datadog-collector-host: datadog-agent.default.svc.cluster.local ``` -NOTE: While the option is called `jaeger-collector-host`, you will need to point this to a `jaeger-agent`, and not the `jaeger-collector` component. +NOTE: While the option is called `jaeger-collector-host`, you will need to point this to a `jaeger-agent`, and not the `jaeger-collector` component. Next you will need to deploy a distributed tracing system which uses OpenTracing. [Zipkin](https://github.com/openzipkin/zipkin) and @@ -147,7 +147,7 @@ In the Zipkin interface we can see the details: # Apply the Ingress Resource $ echo ' - apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: echo-ingress diff --git a/internal/ingress/status/status.go b/internal/ingress/status/status.go index 2c23c9912..bbe6e8383 100644 --- a/internal/ingress/status/status.go +++ b/internal/ingress/status/status.go @@ -278,7 +278,7 @@ func runUpdate(ing *ingress.Ingress, status []apiv1.LoadBalancerIngress, klog.Warningf("error updating ingress rule: %v", err) } } else { - ingClient := client.ExtensionsV1beta1().Ingresses(ing.Namespace) + ingClient := client.NetworkingV1beta1().Ingresses(ing.Namespace) currIng, err := ingClient.Get(ing.Name, metav1.GetOptions{}) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("unexpected error searching Ingress %v/%v", ing.Namespace, ing.Name)) diff --git a/test/e2e/annotations/affinity.go b/test/e2e/annotations/affinity.go index 241d354a4..cbafb9861 100644 --- a/test/e2e/annotations/affinity.go +++ b/test/e2e/annotations/affinity.go @@ -26,7 +26,7 @@ import ( . "github.com/onsi/gomega" "github.com/parnurzeal/gorequest" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -142,29 +142,29 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions", "nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID", } - f.EnsureIngress(&extensions.Ingress{ + f.EnsureIngress(&networking.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: host, Namespace: f.Namespace, Annotations: annotations, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: host, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: "/something", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: framework.EchoService, ServicePort: intstr.FromInt(80), }, }, { Path: "/somewhereelese", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: framework.EchoService, ServicePort: intstr.FromInt(80), }, diff --git a/test/e2e/annotations/customhttperrors.go b/test/e2e/annotations/customhttperrors.go index 358f8778a..c925a520a 100644 --- a/test/e2e/annotations/customhttperrors.go +++ b/test/e2e/annotations/customhttperrors.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" "k8s.io/ingress-nginx/test/e2e/framework" ) @@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func( } By("updating configuration when only custom-http-error value changes") - err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *extensions.Ingress) error { + err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *networking.Ingress) error { ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/custom-http-errors"] = "503" return nil }) @@ -104,7 +104,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func( customDefaultBackend := "from-annotation" f.NewEchoDeploymentWithNameAndReplicas(customDefaultBackend, 1) - err = framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *extensions.Ingress) error { + err = framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *networking.Ingress) error { ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/default-backend"] = customDefaultBackend return nil }) diff --git a/test/e2e/annotations/satisfy.go b/test/e2e/annotations/satisfy.go index aa67a3ea4..dc2cf7049 100644 --- a/test/e2e/annotations/satisfy.go +++ b/test/e2e/annotations/satisfy.go @@ -25,7 +25,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/parnurzeal/gorequest" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/ingress-nginx/test/e2e/framework" ) @@ -62,7 +62,7 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() { f.EnsureIngress(ing) for key, result := range results { - err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *extensions.Ingress) error { + err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *networking.Ingress) error { ingress.ObjectMeta.Annotations[annotationKey] = annotations[key] return nil }) diff --git a/test/e2e/defaultbackend/with_hosts.go b/test/e2e/defaultbackend/with_hosts.go index 1c4830da5..9cf47abf8 100644 --- a/test/e2e/defaultbackend/with_hosts.go +++ b/test/e2e/defaultbackend/with_hosts.go @@ -24,7 +24,7 @@ import ( "strings" "github.com/parnurzeal/gorequest" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/ingress-nginx/test/e2e/framework" @@ -46,18 +46,18 @@ var _ = framework.IngressNginxDescribe("Default backend with hosts", func() { "nginx.ingress.kubernetes.io/proxy-buffer-size": "8k", } - ing := &extensions.Ingress{ + ing := &networking.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "default-backend-annotations", Namespace: f.Namespace, Annotations: annotations, }, - Spec: extensions.IngressSpec{ - Backend: &extensions.IngressBackend{ + Spec: networking.IngressSpec{ + Backend: &networking.IngressBackend{ ServiceName: framework.EchoService, ServicePort: intstr.FromInt(80), }, - Rules: []extensions.IngressRule{ + Rules: []networking.IngressRule{ { Host: host, }, diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 4e49c507a..21d1cff50 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -18,9 +18,10 @@ import ( "strings" "time" + "github.com/pkg/errors" appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" apiextcs "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" @@ -28,8 +29,6 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" restclient "k8s.io/client-go/rest" - - "github.com/pkg/errors" "k8s.io/klog" . "github.com/onsi/ginkgo" @@ -393,8 +392,8 @@ func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name } // UpdateIngress runs the given updateFunc on the ingress -func UpdateIngress(kubeClientSet kubernetes.Interface, namespace string, name string, updateFunc func(d *extensions.Ingress) error) error { - ingress, err := kubeClientSet.ExtensionsV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{}) +func UpdateIngress(kubeClientSet kubernetes.Interface, namespace string, name string, updateFunc func(d *networking.Ingress) error) error { + ingress, err := kubeClientSet.NetworkingV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{}) if err != nil { return err } @@ -403,37 +402,37 @@ func UpdateIngress(kubeClientSet kubernetes.Interface, namespace string, name st return err } - _, err = kubeClientSet.ExtensionsV1beta1().Ingresses(namespace).Update(ingress) + _, err = kubeClientSet.NetworkingV1beta1().Ingresses(namespace).Update(ingress) return err } // 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) *extensions.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) *extensions.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) *extensions.Ingress { - spec := extensions.IngressSpec{ - Rules: []extensions.IngressRule{ +func NewSingleIngressWithMultiplePaths(name string, paths []string, host, ns, service string, port int, annotations *map[string]string) *networking.Ingress { + spec := networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: host, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{}, + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{}, }, }, }, } for _, path := range paths { - spec.Rules[0].IngressRuleValue.HTTP.Paths = append(spec.Rules[0].IngressRuleValue.HTTP.Paths, extensions.HTTPIngressPath{ + spec.Rules[0].IngressRuleValue.HTTP.Paths = append(spec.Rules[0].IngressRuleValue.HTTP.Paths, networking.HTTPIngressPath{ Path: path, - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: service, ServicePort: intstr.FromInt(port), }, @@ -443,18 +442,18 @@ 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) *extensions.Ingress { +func newSingleIngressWithRules(name, path, host, ns, service string, port int, annotations *map[string]string, tlsHosts []string) *networking.Ingress { - spec := extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + spec := networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: host, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: path, - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: service, ServicePort: intstr.FromInt(port), }, @@ -467,7 +466,7 @@ func newSingleIngressWithRules(name, path, host, ns, service string, port int, a } if len(tlsHosts) > 0 { - spec.TLS = []extensions.IngressTLS{ + spec.TLS = []networking.IngressTLS{ { Hosts: tlsHosts, SecretName: host, @@ -479,21 +478,21 @@ 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) *extensions.Ingress { - spec := extensions.IngressSpec{ - Backend: &extensions.IngressBackend{ +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, ServicePort: intstr.FromInt(defaultPort), }, - Rules: []extensions.IngressRule{ + Rules: []networking.IngressRule{ { Host: host, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: path, - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: service, ServicePort: intstr.FromInt(port), }, @@ -509,9 +508,9 @@ 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) *extensions.Ingress { - spec := extensions.IngressSpec{ - Backend: &extensions.IngressBackend{ +func NewSingleCatchAllIngress(name, ns, service string, port int, annotations *map[string]string) *networking.Ingress { + spec := networking.IngressSpec{ + Backend: &networking.IngressBackend{ ServiceName: service, ServicePort: intstr.FromInt(port), }, @@ -519,12 +518,12 @@ 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 extensions.IngressSpec) *extensions.Ingress { +func newSingleIngress(name, ns string, annotations *map[string]string, spec networking.IngressSpec) *networking.Ingress { if annotations == nil { annotations = &map[string]string{} } - ing := &extensions.Ingress{ + ing := &networking.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, diff --git a/test/e2e/framework/k8s.go b/test/e2e/framework/k8s.go index b5fd1c688..760ef2d6a 100644 --- a/test/e2e/framework/k8s.go +++ b/test/e2e/framework/k8s.go @@ -26,7 +26,7 @@ import ( appsv1 "k8s.io/api/apps/v1" api "k8s.io/api/core/v1" core "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" k8sErrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" @@ -68,11 +68,11 @@ func (f *Framework) EnsureConfigMap(configMap *api.ConfigMap) (*api.ConfigMap, e } // EnsureIngress creates an Ingress object or returns it if it already exists. -func (f *Framework) EnsureIngress(ingress *extensions.Ingress) *extensions.Ingress { - ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Update(ingress) +func (f *Framework) EnsureIngress(ingress *networking.Ingress) *networking.Ingress { + ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(ingress.Namespace).Update(ingress) if err != nil { if k8sErrors.IsNotFound(err) { - ing, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Create(ingress) + ing, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(ingress.Namespace).Create(ingress) Expect(err).NotTo(HaveOccurred(), "unexpected error creating ingress") return ing } diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 8e00d404a..e28419334 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -235,7 +235,7 @@ func WaitForNoIngressInNamespace(c kubernetes.Interface, namespace, name string) func noIngressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc { return func() (bool, error) { - ing, err := c.ExtensionsV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{}) + ing, err := c.NetworkingV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { return true, nil } @@ -257,7 +257,7 @@ func WaitForIngressInNamespace(c kubernetes.Interface, namespace, name string) e func ingressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc { return func() (bool, error) { - ing, err := c.ExtensionsV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{}) + ing, err := c.NetworkingV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { return false, nil } diff --git a/test/e2e/leaks/lua_ssl.go b/test/e2e/leaks/lua_ssl.go index ecd11c7cb..2ab9e0b39 100644 --- a/test/e2e/leaks/lua_ssl.go +++ b/test/e2e/leaks/lua_ssl.go @@ -104,7 +104,7 @@ func checkIngress(hostname string, f *framework.Framework) { } func deleteIngress(hostname string, f *framework.Framework) { - err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Delete(hostname, &metav1.DeleteOptions{}) + err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Delete(hostname, &metav1.DeleteOptions{}) Expect(err).NotTo(HaveOccurred(), "unexpected error deleting ingress") } diff --git a/test/e2e/lua/dynamic_certificates.go b/test/e2e/lua/dynamic_certificates.go index 9d80f0402..2855d40cf 100644 --- a/test/e2e/lua/dynamic_certificates.go +++ b/test/e2e/lua/dynamic_certificates.go @@ -27,7 +27,7 @@ import ( dto "github.com/prometheus/client_model/go" "github.com/prometheus/common/expfmt" "github.com/prometheus/common/model" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/ingress-nginx/test/e2e/framework" @@ -44,9 +44,9 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() { It("picks up the certificate when we add TLS spec to existing ingress", func() { ensureIngress(f, host, framework.EchoService) - ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) + ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - ing.Spec.TLS = []extensions.IngressTLS{ + ing.Spec.TLS = []networking.IngressTLS{ { Hosts: []string{host}, SecretName: host, @@ -57,7 +57,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() { ing.Spec.TLS[0].SecretName, ing.Namespace) Expect(err).ToNot(HaveOccurred()) - _, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ing) + _, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Update(ing) Expect(err).ToNot(HaveOccurred()) time.Sleep(waitForLuaSync) @@ -143,7 +143,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() { }) It("picks up the updated certificate without reloading", func() { - ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) + ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host) @@ -177,7 +177,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() { }) It("falls back to using default certificate when secret gets deleted without reloading", func() { - ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) + ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host) @@ -210,10 +210,10 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() { It("picks up a non-certificate only change", func() { newHost := "foo2.com" - ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) + ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred()) ing.Spec.Rules[0].Host = newHost - _, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ing) + _, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Update(ing) Expect(err).ToNot(HaveOccurred()) time.Sleep(waitForLuaSync) @@ -222,10 +222,10 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() { }) It("removes HTTPS configuration when we delete TLS spec", func() { - ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) + ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred()) - ing.Spec.TLS = []extensions.IngressTLS{} - _, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ing) + ing.Spec.TLS = []networking.IngressTLS{} + _, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Update(ing) Expect(err).ToNot(HaveOccurred()) time.Sleep(waitForLuaSync) diff --git a/test/e2e/lua/dynamic_configuration.go b/test/e2e/lua/dynamic_configuration.go index 20beefe68..b69bc8e7f 100644 --- a/test/e2e/lua/dynamic_configuration.go +++ b/test/e2e/lua/dynamic_configuration.go @@ -27,7 +27,7 @@ import ( . "github.com/onsi/gomega" "github.com/parnurzeal/gorequest" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/ingress-nginx/internal/nginx" @@ -146,11 +146,11 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() { return true }) - ingress, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get("foo.com", metav1.GetOptions{}) + ingress, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get("foo.com", metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/load-balance"] = "round_robin" - _, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ingress) + _, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Update(ingress) Expect(err).ToNot(HaveOccurred()) time.Sleep(waitForLuaSync) @@ -184,7 +184,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() { }) }) -func ensureIngress(f *framework.Framework, host string, deploymentName string) *extensions.Ingress { +func ensureIngress(f *framework.Framework, host string, deploymentName string) *networking.Ingress { ing := createIngress(f, host, deploymentName) time.Sleep(waitForLuaSync) ensureRequest(f, host) @@ -192,7 +192,7 @@ func ensureIngress(f *framework.Framework, host string, deploymentName string) * return ing } -func createIngress(f *framework.Framework, host string, deploymentName string) *extensions.Ingress { +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"})) diff --git a/test/e2e/run.sh b/test/e2e/run.sh index bade28563..678d2d996 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -14,11 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -KIND_LOG_LEVEL="info" +KIND_LOG_LEVEL="0" if ! [ -z $DEBUG ]; then set -x - KIND_LOG_LEVEL="debug" + KIND_LOG_LEVEL="6" fi set -o errexit @@ -41,7 +41,7 @@ export TAG=dev export ARCH=amd64 export REGISTRY=ingress-controller -export K8S_VERSION=${K8S_VERSION:-v1.15.3} +export K8S_VERSION=${K8S_VERSION:-v1.17.0} KIND_CLUSTER_NAME="ingress-nginx-dev" @@ -51,7 +51,7 @@ echo "[dev-env] creating Kubernetes cluster with kind" export KUBECONFIG="${HOME}/.kube/kind-config-${KIND_CLUSTER_NAME}" kind create cluster \ - --loglevel=${KIND_LOG_LEVEL} \ + --verbosity=${KIND_LOG_LEVEL} \ --name ${KIND_CLUSTER_NAME} \ --config ${DIR}/kind.yaml \ --image "kindest/node:${K8S_VERSION}" @@ -59,15 +59,13 @@ kind create cluster \ echo "Kubernetes cluster:" kubectl get nodes -o wide -kubectl config set-context kubernetes-admin@${KIND_CLUSTER_NAME} - echo "[dev-env] building container" echo " make -C ${DIR}/../../ build container make -C ${DIR}/../../ e2e-test-image make -C ${DIR}/../../images/fastcgi-helloserver/ build container make -C ${DIR}/../../images/httpbin/ container -" | parallel --progress {} +" | parallel --progress --joblog /tmp/log {} || cat /tmp/log # Remove after https://github.com/kubernetes/ingress-nginx/pull/4271 is merged docker tag ${REGISTRY}/nginx-ingress-controller-${ARCH}:${TAG} ${REGISTRY}/nginx-ingress-controller:${TAG} @@ -82,11 +80,11 @@ kind load docker-image --name="${KIND_CLUSTER_NAME}" ${REGISTRY}/nginx-ingress-c kind load docker-image --name="${KIND_CLUSTER_NAME}" ${REGISTRY}/fastcgi-helloserver:${TAG} kind load docker-image --name="${KIND_CLUSTER_NAME}" openresty/openresty:1.15.8.2-alpine kind load docker-image --name="${KIND_CLUSTER_NAME}" ${REGISTRY}/httpbin:${TAG} -" | parallel --progress +" | parallel --progress --joblog /tmp/log {} || cat /tmp/log echo "[dev-env] running e2e tests..." make -C ${DIR}/../../ e2e-test kind delete cluster \ - --loglevel=${KIND_LOG_LEVEL} \ + --verbosity=${KIND_LOG_LEVEL} \ --name ${KIND_CLUSTER_NAME} diff --git a/test/e2e/servicebackend/service_backend.go b/test/e2e/servicebackend/service_backend.go index 3829104bb..3a6dba086 100644 --- a/test/e2e/servicebackend/service_backend.go +++ b/test/e2e/servicebackend/service_backend.go @@ -25,7 +25,7 @@ import ( "github.com/parnurzeal/gorequest" corev1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -85,23 +85,23 @@ var _ = framework.IngressNginxDescribe("Service backend - 503", func() { }) -func buildIngressWithNonexistentService(host, namespace, path string) *extensions.Ingress { +func buildIngressWithNonexistentService(host, namespace, path string) *networking.Ingress { backendService := "nonexistent-svc" - return &extensions.Ingress{ + return &networking.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: host, Namespace: namespace, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: host, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: path, - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: backendService, ServicePort: intstr.FromInt(80), }, @@ -115,23 +115,23 @@ func buildIngressWithNonexistentService(host, namespace, path string) *extension } } -func buildIngressWithUnavailableServiceEndpoints(host, namespace, path string) (*extensions.Ingress, *corev1.Service) { +func buildIngressWithUnavailableServiceEndpoints(host, namespace, path string) (*networking.Ingress, *corev1.Service) { backendService := "unavailable-svc" - return &extensions.Ingress{ + return &networking.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: host, Namespace: namespace, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: host, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: path, - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: backendService, ServicePort: intstr.FromInt(80), }, diff --git a/test/e2e/settings/disable_catch_all.go b/test/e2e/settings/disable_catch_all.go index f5a56f089..95d4b4f81 100644 --- a/test/e2e/settings/disable_catch_all.go +++ b/test/e2e/settings/disable_catch_all.go @@ -25,7 +25,7 @@ import ( "github.com/parnurzeal/gorequest" appsv1 "k8s.io/api/apps/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/ingress-nginx/test/e2e/framework" @@ -88,9 +88,9 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() { Expect(errs).To(BeNil()) Expect(resp.StatusCode).Should(Equal(http.StatusOK)) - err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *extensions.Ingress) error { + err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *networking.Ingress) error { ingress.Spec.Rules = nil - ingress.Spec.Backend = &extensions.IngressBackend{ + ingress.Spec.Backend = &networking.IngressBackend{ ServiceName: framework.EchoService, ServicePort: intstr.FromInt(80), } diff --git a/test/e2e/settings/no_auth_locations.go b/test/e2e/settings/no_auth_locations.go index a9ea8b90d..da52222f1 100644 --- a/test/e2e/settings/no_auth_locations.go +++ b/test/e2e/settings/no_auth_locations.go @@ -26,7 +26,7 @@ import ( "github.com/parnurzeal/gorequest" corev1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/ingress-nginx/test/e2e/framework" @@ -104,8 +104,8 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() { }) }) -func buildBasicAuthIngressWithSecondPath(host, namespace, secretName, pathName string) *extensions.Ingress { - return &extensions.Ingress{ +func buildBasicAuthIngressWithSecondPath(host, namespace, secretName, pathName string) *networking.Ingress { + return &networking.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: host, Namespace: namespace, @@ -114,23 +114,23 @@ func buildBasicAuthIngressWithSecondPath(host, namespace, secretName, pathName s "nginx.ingress.kubernetes.io/auth-realm": "test auth", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: host, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: "/", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: framework.EchoService, ServicePort: intstr.FromInt(80), }, }, { Path: pathName, - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: framework.EchoService, ServicePort: intstr.FromInt(80), }, diff --git a/test/e2e/settings/pod_security_policy.go b/test/e2e/settings/pod_security_policy.go index 9c7c65d2a..77e5a3415 100644 --- a/test/e2e/settings/pod_security_policy.go +++ b/test/e2e/settings/pod_security_policy.go @@ -27,7 +27,7 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + policyv1beta1 "k8s.io/api/policy/v1beta1" rbacv1 "k8s.io/api/rbac/v1" k8sErrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -44,7 +44,7 @@ var _ = framework.IngressNginxDescribe("Pod Security Policies", func() { BeforeEach(func() { psp := createPodSecurityPolicy() - _, err := f.KubeClientSet.ExtensionsV1beta1().PodSecurityPolicies().Create(psp) + _, err := f.KubeClientSet.PolicyV1beta1().PodSecurityPolicies().Create(psp) if !k8sErrors.IsAlreadyExists(err) { Expect(err).NotTo(HaveOccurred(), "creating Pod Security Policy") } @@ -92,23 +92,23 @@ var _ = framework.IngressNginxDescribe("Pod Security Policies", func() { }) }) -func createPodSecurityPolicy() *extensions.PodSecurityPolicy { +func createPodSecurityPolicy() *policyv1beta1.PodSecurityPolicy { trueValue := true - return &extensions.PodSecurityPolicy{ + return &policyv1beta1.PodSecurityPolicy{ ObjectMeta: metav1.ObjectMeta{ Name: ingressControllerPSP, }, - Spec: extensions.PodSecurityPolicySpec{ + Spec: policyv1beta1.PodSecurityPolicySpec{ AllowPrivilegeEscalation: &trueValue, RequiredDropCapabilities: []corev1.Capability{"All"}, - RunAsUser: extensions.RunAsUserStrategyOptions{ + RunAsUser: policyv1beta1.RunAsUserStrategyOptions{ Rule: "RunAsAny", }, - SELinux: extensions.SELinuxStrategyOptions{ + SELinux: policyv1beta1.SELinuxStrategyOptions{ Rule: "RunAsAny", }, - FSGroup: extensions.FSGroupStrategyOptions{ - Ranges: []extensions.IDRange{ + FSGroup: policyv1beta1.FSGroupStrategyOptions{ + Ranges: []policyv1beta1.IDRange{ { Min: 1, Max: 65535, @@ -116,8 +116,8 @@ func createPodSecurityPolicy() *extensions.PodSecurityPolicy { }, Rule: "MustRunAs", }, - SupplementalGroups: extensions.SupplementalGroupsStrategyOptions{ - Ranges: []extensions.IDRange{ + SupplementalGroups: policyv1beta1.SupplementalGroupsStrategyOptions{ + Ranges: []policyv1beta1.IDRange{ { Min: 1, Max: 65535, diff --git a/test/e2e/settings/pod_security_policy_volumes.go b/test/e2e/settings/pod_security_policy_volumes.go index e022c3106..f05cb5ed6 100644 --- a/test/e2e/settings/pod_security_policy_volumes.go +++ b/test/e2e/settings/pod_security_policy_volumes.go @@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Pod Security Policies with volumes", fun It("should be running with a Pod Security Policy", func() { psp := createPodSecurityPolicy() - _, err := f.KubeClientSet.ExtensionsV1beta1().PodSecurityPolicies().Create(psp) + _, err := f.KubeClientSet.PolicyV1beta1().PodSecurityPolicies().Create(psp) if !k8sErrors.IsAlreadyExists(err) { Expect(err).NotTo(HaveOccurred(), "creating Pod Security Policy") } diff --git a/test/e2e/settings/server_tokens.go b/test/e2e/settings/server_tokens.go index ca659ce97..0ef4b46c6 100644 --- a/test/e2e/settings/server_tokens.go +++ b/test/e2e/settings/server_tokens.go @@ -21,7 +21,7 @@ import ( . "github.com/onsi/ginkgo" - extensions "k8s.io/api/extensions/v1beta1" + networking "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/ingress-nginx/test/e2e/framework" @@ -53,22 +53,22 @@ var _ = framework.IngressNginxDescribe("Server Tokens", func() { It("should exists Server header in the response when is enabled", func() { f.UpdateNginxConfigMapData(serverTokens, "true") - f.EnsureIngress(&extensions.Ingress{ + f.EnsureIngress(&networking.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: serverTokens, Namespace: f.Namespace, Annotations: map[string]string{}, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networking.IngressSpec{ + Rules: []networking.IngressRule{ { Host: serverTokens, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networking.IngressRuleValue{ + HTTP: &networking.HTTPIngressRuleValue{ + Paths: []networking.HTTPIngressPath{ { Path: "/", - Backend: extensions.IngressBackend{ + Backend: networking.IngressBackend{ ServiceName: framework.EchoService, ServicePort: intstr.FromInt(80), }, diff --git a/test/e2e/status/update.go b/test/e2e/status/update.go index ea77b9097..ede8d1023 100644 --- a/test/e2e/status/update.go +++ b/test/e2e/status/update.go @@ -87,11 +87,11 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() { err = cmd.Process.Kill() Expect(err).NotTo(HaveOccurred(), "unexpected error terminating kubectl proxy") - ing, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) + ing, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred(), "unexpected error getting %s/%v Ingress", f.Namespace, host) ing.Status.LoadBalancer.Ingress = []apiv1.LoadBalancerIngress{} - _, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).UpdateStatus(ing) + _, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).UpdateStatus(ing) Expect(err).NotTo(HaveOccurred(), "unexpected error cleaning Ingress status") time.Sleep(10 * time.Second) @@ -110,7 +110,7 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() { }() err = wait.Poll(10*time.Second, framework.DefaultTimeout, func() (done bool, err error) { - ing, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) + ing, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{}) if err != nil { return false, nil } From 1800ffa30d54c9186ce42eba551064fb02893a8f Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Thu, 12 Dec 2019 21:24:41 -0300 Subject: [PATCH 2/7] Use deployments only from apps/v1 group --- .../e2e-image/overlay/deployment-extension-group-patch.yaml | 3 --- test/e2e-image/overlay/kustomization.yaml | 6 ------ 2 files changed, 9 deletions(-) delete mode 100644 test/e2e-image/overlay/deployment-extension-group-patch.yaml diff --git a/test/e2e-image/overlay/deployment-extension-group-patch.yaml b/test/e2e-image/overlay/deployment-extension-group-patch.yaml deleted file mode 100644 index 837a5f7e1..000000000 --- a/test/e2e-image/overlay/deployment-extension-group-patch.yaml +++ /dev/null @@ -1,3 +0,0 @@ -- op: replace - path: /apiVersion - value: extensions/v1beta1 diff --git a/test/e2e-image/overlay/kustomization.yaml b/test/e2e-image/overlay/kustomization.yaml index 8c64132e6..8b357e134 100644 --- a/test/e2e-image/overlay/kustomization.yaml +++ b/test/e2e-image/overlay/kustomization.yaml @@ -22,12 +22,6 @@ patchesJson6902: kind: Service name: ingress-nginx version: v1 -- path: deployment-extension-group-patch.yaml - target: - group: apps - kind: Deployment - name: nginx-ingress-controller - version: v1 - path: role.yaml target: group: rbac.authorization.k8s.io From 508d8db015cc445d48f9b52729210c601c277063 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Thu, 12 Dec 2019 21:43:50 -0300 Subject: [PATCH 3/7] Update kind to v0.6.1 --- images/e2e-prow/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/e2e-prow/Makefile b/images/e2e-prow/Makefile index 44cf314f3..2bb2851af 100644 --- a/images/e2e-prow/Makefile +++ b/images/e2e-prow/Makefile @@ -9,9 +9,9 @@ all: docker-build docker-push docker-build: $(DOCKER) build \ --pull \ - --build-arg K8S_RELEASE=v1.16.3 \ + --build-arg K8S_RELEASE=v1.17.0 \ --build-arg ETCD_VERSION=v3.3.15 \ - --build-arg KIND_VERSION=v0.6.0 \ + --build-arg KIND_VERSION=v0.6.1 \ -t $(IMAGE):$(TAG) . docker-push: From ba2bef7a726ef876cb72cc2772bf2d86610aa6a0 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Thu, 12 Dec 2019 22:07:03 -0300 Subject: [PATCH 4/7] Add parallel to e2e-prow image --- images/e2e-prow/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/images/e2e-prow/Dockerfile b/images/e2e-prow/Dockerfile index 189b73c61..921e9c4d6 100644 --- a/images/e2e-prow/Dockerfile +++ b/images/e2e-prow/Dockerfile @@ -39,6 +39,7 @@ RUN apt-get update \ && apt-get install -y \ bc \ rpm \ + parallel \ && rm -rf /var/lib/apt/lists/* ARG K8S_RELEASE From bcdd9750254a9a148729ec609250f9864d10b891 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Thu, 12 Dec 2019 22:13:34 -0300 Subject: [PATCH 5/7] Fix code-generator task --- hack/update-codegen.sh | 2 ++ vendor/k8s.io/code-generator/generate-groups.sh | 0 .../code-generator/generate-internal-groups.sh | 0 .../code-generator/hack/boilerplate.go.txt | 16 ++++++++++++++++ 4 files changed, 18 insertions(+) mode change 100644 => 100755 vendor/k8s.io/code-generator/generate-groups.sh mode change 100644 => 100755 vendor/k8s.io/code-generator/generate-internal-groups.sh create mode 100644 vendor/k8s.io/code-generator/hack/boilerplate.go.txt diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index f30124a2d..d86180bd8 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -18,6 +18,8 @@ set -o errexit set -o nounset set -o pipefail +export GO111MODULE=off + SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} diff --git a/vendor/k8s.io/code-generator/generate-groups.sh b/vendor/k8s.io/code-generator/generate-groups.sh old mode 100644 new mode 100755 diff --git a/vendor/k8s.io/code-generator/generate-internal-groups.sh b/vendor/k8s.io/code-generator/generate-internal-groups.sh old mode 100644 new mode 100755 diff --git a/vendor/k8s.io/code-generator/hack/boilerplate.go.txt b/vendor/k8s.io/code-generator/hack/boilerplate.go.txt new file mode 100644 index 000000000..59e740c1e --- /dev/null +++ b/vendor/k8s.io/code-generator/hack/boilerplate.go.txt @@ -0,0 +1,16 @@ +/* +Copyright YEAR The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + From c2550930b15f2a20a0aceec2656fccdbcebdd38a Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Thu, 12 Dec 2019 23:07:50 -0300 Subject: [PATCH 6/7] Fix e2e test flakes --- test/e2e/framework/deployment.go | 14 ++--- test/e2e/framework/fastcgi_helloserver.go | 5 +- test/e2e/framework/grpc_fortune_teller.go | 5 +- test/e2e/framework/influxdb.go | 4 +- test/e2e/framework/k8s.go | 65 +++++++++++++++-------- test/e2e/settings/ingress_class.go | 4 ++ 6 files changed, 57 insertions(+), 40 deletions(-) diff --git a/test/e2e/framework/deployment.go b/test/e2e/framework/deployment.go index c1c8c02c0..564e26f80 100644 --- a/test/e2e/framework/deployment.go +++ b/test/e2e/framework/deployment.go @@ -187,8 +187,7 @@ Request Body: }, ) - d, err := f.EnsureDeployment(deployment) - Expect(err).NotTo(HaveOccurred(), "failed to create a deployment") + d := f.EnsureDeployment(deployment) Expect(d).NotTo(BeNil(), "expected a deployment but none returned") service := &corev1.Service{ @@ -273,8 +272,7 @@ server { }, ) - d, err := f.EnsureDeployment(deployment) - Expect(err).NotTo(HaveOccurred(), "failed to create a deployment") + d := f.EnsureDeployment(deployment) Expect(d).NotTo(BeNil(), "expected a deployment but none returned") service := &corev1.Service{ @@ -377,8 +375,7 @@ func (f *Framework) NewHttpbinDeployment() { func (f *Framework) NewDeployment(name, image string, port int32, replicas int32) { deployment := newDeployment(name, f.Namespace, image, port, replicas, nil, nil, nil) - d, err := f.EnsureDeployment(deployment) - Expect(err).NotTo(HaveOccurred(), "failed to create a deployment") + d := f.EnsureDeployment(deployment) Expect(d).NotTo(BeNil(), "expected a deployment but none returned") service := &corev1.Service{ @@ -404,7 +401,7 @@ func (f *Framework) NewDeployment(name, image string, port int32, replicas int32 s := f.EnsureService(service) Expect(s).NotTo(BeNil(), "expected a service but none returned") - err = WaitForEndpoints(f.KubeClientSet, DefaultTimeout, name, f.Namespace, int(replicas)) + err := WaitForEndpoints(f.KubeClientSet, DefaultTimeout, name, f.Namespace, int(replicas)) Expect(err).NotTo(HaveOccurred(), "failed to wait for endpoints to become ready") } @@ -427,7 +424,6 @@ func (f *Framework) ScaleDeploymentToZero(name string) { d.Spec.Replicas = NewInt32(0) - d, err = f.EnsureDeployment(d) - Expect(err).NotTo(HaveOccurred(), "waiting deployment scale to 0") + d = f.EnsureDeployment(d) Expect(d).NotTo(BeNil(), "expected a deployment but none returned") } diff --git a/test/e2e/framework/fastcgi_helloserver.go b/test/e2e/framework/fastcgi_helloserver.go index 5c1b0b31a..dc7388186 100644 --- a/test/e2e/framework/fastcgi_helloserver.go +++ b/test/e2e/framework/fastcgi_helloserver.go @@ -73,11 +73,10 @@ func (f *Framework) NewNewFastCGIHelloServerDeploymentWithReplicas(replicas int3 }, } - d, err := f.EnsureDeployment(deployment) - Expect(err).NotTo(HaveOccurred()) + d := f.EnsureDeployment(deployment) Expect(d).NotTo(BeNil(), "expected a fastcgi-helloserver deployment") - err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{ + err := WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{ LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(), }) Expect(err).NotTo(HaveOccurred(), "failed to wait for to become ready") diff --git a/test/e2e/framework/grpc_fortune_teller.go b/test/e2e/framework/grpc_fortune_teller.go index 7cab3e026..4bbeee65b 100644 --- a/test/e2e/framework/grpc_fortune_teller.go +++ b/test/e2e/framework/grpc_fortune_teller.go @@ -73,11 +73,10 @@ func (f *Framework) NewNewGRPCFortuneTellerDeploymentWithReplicas(replicas int32 }, } - d, err := f.EnsureDeployment(deployment) - Expect(err).NotTo(HaveOccurred()) + d := f.EnsureDeployment(deployment) Expect(d).NotTo(BeNil(), "expected a fortune-teller deployment") - err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{ + err := WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{ LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(), }) Expect(err).NotTo(HaveOccurred(), "failed to wait for to become ready") diff --git a/test/e2e/framework/influxdb.go b/test/e2e/framework/influxdb.go index c2ca8d7f0..c38bf9c4a 100644 --- a/test/e2e/framework/influxdb.go +++ b/test/e2e/framework/influxdb.go @@ -135,9 +135,7 @@ func (f *Framework) NewInfluxDBDeployment() { }, } - d, err := f.EnsureDeployment(deployment) - Expect(err).NotTo(HaveOccurred(), "failed to create an Influxdb deployment") - + d := f.EnsureDeployment(deployment) Expect(d).NotTo(BeNil(), "unexpected error creating deployment for influxdb") err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.Namespace, metav1.ListOptions{ diff --git a/test/e2e/framework/k8s.go b/test/e2e/framework/k8s.go index 760ef2d6a..6d06df966 100644 --- a/test/e2e/framework/k8s.go +++ b/test/e2e/framework/k8s.go @@ -31,6 +31,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" + "k8s.io/client-go/util/retry" podutil "k8s.io/kubernetes/pkg/api/v1/pod" ) @@ -69,18 +70,24 @@ func (f *Framework) EnsureConfigMap(configMap *api.ConfigMap) (*api.ConfigMap, e // EnsureIngress creates an Ingress object or returns it if it already exists. func (f *Framework) EnsureIngress(ingress *networking.Ingress) *networking.Ingress { - ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(ingress.Namespace).Update(ingress) + ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(ingress.Namespace).Create(ingress) if err != nil { - if k8sErrors.IsNotFound(err) { - ing, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(ingress.Namespace).Create(ingress) - Expect(err).NotTo(HaveOccurred(), "unexpected error creating ingress") - return ing - } + if k8sErrors.IsAlreadyExists(err) { + err = retry.RetryOnConflict(retry.DefaultRetry, func() error { + var err error + ing, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(ingress.Namespace).Update(ingress) + if err != nil { + return err + } - Expect(err).NotTo(HaveOccurred()) + return nil + }) + + Expect(err).NotTo(HaveOccurred()) + } } - Expect(ing).NotTo(BeNil()) + Expect(ing).NotTo(BeNil(), "expected an ingress but none returned") if ing.Annotations == nil { ing.Annotations = make(map[string]string) @@ -91,33 +98,47 @@ func (f *Framework) EnsureIngress(ingress *networking.Ingress) *networking.Ingre // EnsureService creates a Service object or returns it if it already exists. func (f *Framework) EnsureService(service *core.Service) *core.Service { - s, err := f.KubeClientSet.CoreV1().Services(service.Namespace).Update(service) + s, err := f.KubeClientSet.CoreV1().Services(service.Namespace).Create(service) if err != nil { - if k8sErrors.IsNotFound(err) { - s, err := f.KubeClientSet.CoreV1().Services(service.Namespace).Create(service) - Expect(err).NotTo(HaveOccurred(), "unexpected error creating service") - return s + if k8sErrors.IsAlreadyExists(err) { + err = retry.RetryOnConflict(retry.DefaultRetry, func() error { + var err error + s, err = f.KubeClientSet.CoreV1().Services(service.Namespace).Update(service) + if err != nil { + return err + } + return nil + }) + + Expect(err).NotTo(HaveOccurred()) } - - Expect(err).NotTo(HaveOccurred()) } Expect(s).NotTo(BeNil(), "expected a service but none returned") - return s } // EnsureDeployment creates a Deployment object or returns it if it already exists. -func (f *Framework) EnsureDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) { - d, err := f.KubeClientSet.AppsV1().Deployments(deployment.Namespace).Update(deployment) +func (f *Framework) EnsureDeployment(deployment *appsv1.Deployment) *appsv1.Deployment { + d, err := f.KubeClientSet.AppsV1().Deployments(deployment.Namespace).Create(deployment) if err != nil { - if k8sErrors.IsNotFound(err) { - return f.KubeClientSet.AppsV1().Deployments(deployment.Namespace).Create(deployment) + if k8sErrors.IsAlreadyExists(err) { + err = retry.RetryOnConflict(retry.DefaultRetry, func() error { + d, err = f.KubeClientSet.AppsV1().Deployments(deployment.Namespace).Update(deployment) + if err != nil { + return err + } + + return nil + }) + + Expect(err).NotTo(HaveOccurred()) } - return nil, err } - return d, nil + + Expect(d).NotTo(BeNil(), "expected a deployment but none returned") + return d } // WaitForPodsReady waits for a given amount of time until a group of Pods is running in the given namespace. diff --git a/test/e2e/settings/ingress_class.go b/test/e2e/settings/ingress_class.go index be95b2657..0108113e9 100644 --- a/test/e2e/settings/ingress_class.go +++ b/test/e2e/settings/ingress_class.go @@ -24,6 +24,7 @@ import ( . "github.com/onsi/gomega" "github.com/parnurzeal/gorequest" appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/ingress-nginx/test/e2e/framework" ) @@ -141,6 +142,9 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() { Expect(errs).To(BeNil()) Expect(resp.StatusCode).Should(Equal(http.StatusOK)) + 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) 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 7/7] 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 {