Migrate ingress definitions from extensions to networking.k8s.io

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-12-12 20:12:12 -03:00
parent be1907142b
commit 0dce5be743
49 changed files with 186 additions and 189 deletions

View file

@ -7,7 +7,7 @@ webhooks:
- name: validate.nginx.ingress.kubernetes.io - name: validate.nginx.ingress.kubernetes.io
rules: rules:
- apiGroups: - apiGroups:
- extensions - networking.k8s.io
apiVersions: apiVersions:
- v1beta1 - v1beta1
operations: operations:
@ -20,6 +20,6 @@ webhooks:
service: service:
namespace: ingress-nginx namespace: ingress-nginx
name: nginx-ingress-webhook name: nginx-ingress-webhook
path: /extensions/v1beta1/ingresses path: /networking.k8s.io/v1beta1/ingresses
caBundle: <certificate.pem | base64> caBundle: <certificate.pem | base64>
--- ---

View file

@ -148,7 +148,7 @@ webhooks:
- name: validate.nginx.ingress.kubernetes.io - name: validate.nginx.ingress.kubernetes.io
rules: rules:
- apiGroups: - apiGroups:
- extensions - networking.k8s.io/v1beta1
apiVersions: apiVersions:
- v1beta1 - v1beta1
operations: operations:
@ -161,7 +161,7 @@ webhooks:
service: service:
namespace: ingress-nginx namespace: ingress-nginx
name: ingress-validation-webhook name: ingress-validation-webhook
path: /extensions/v1beta1/ingress path: /networking.k8s.io/v1beta1/ingress
caBundle: <pem encoded ca cert that signs the server cert used by the webhook> caBundle: <pem encoded ca cert that signs the server cert used by the webhook>
``` ```

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: nginx-test name: nginx-test

View file

@ -30,7 +30,7 @@ type: Opaque
```console ```console
echo " echo "
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: ingress-with-auth name: ingress-with-auth

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -13,7 +13,7 @@ NAME HOSTS ADDRESS PORTS AGE
external-auth external-auth-01.sample.com 172.17.4.99 80 13s external-auth external-auth-01.sample.com 172.17.4.99 80 13s
$ kubectl get ing external-auth -o yaml $ kubectl get ing external-auth -o yaml
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:
@ -18,7 +18,7 @@ spec:
--- ---
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: oauth2-proxy name: oauth2-proxy

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
labels: labels:

View file

@ -54,7 +54,7 @@ spec:
targetPort: 8080 targetPort: 8080
--- ---
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: nginx-configuration-snippet name: nginx-configuration-snippet

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: demo-auth-service name: demo-auth-service

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: demo-echo-service name: demo-echo-service
@ -43,7 +43,7 @@ spec:
selector: selector:
k8s-app: demo-echo-service k8s-app: demo-echo-service
--- ---
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: public-demo-echo-service name: public-demo-echo-service
@ -61,7 +61,7 @@ spec:
servicePort: 80 servicePort: 80
path: / path: /
--- ---
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: secure-demo-echo-service name: secure-demo-echo-service

View file

@ -5,7 +5,7 @@ metadata:
--- ---
apiVersion: extensions/v1beta1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: docker-registry name: docker-registry

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: fortune-teller-app name: fortune-teller-app

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: http-svc name: http-svc

View file

@ -92,7 +92,7 @@ spec:
fieldPath: status.podIP fieldPath: status.podIP
--- ---
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: foo-tls name: foo-tls

View file

@ -34,7 +34,7 @@ Create an Ingress rule with a rewrite annotation:
```console ```console
$ echo ' $ echo '
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: 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: Create an Ingress rule with a app-root annotation:
``` ```
$ echo " $ echo "
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: ingress-nginx name: ingress-nginx

View file

@ -11,7 +11,7 @@ You need a [TLS cert](../PREREQUISITES.md#tls-certificates) and a [test HTTP ser
Create a `values.yaml` file. Create a `values.yaml` file.
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: nginx-test name: nginx-test

View file

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: nginx-test name: nginx-test

View file

@ -32,7 +32,7 @@ Rules:
/tea tea-svc:80 (<none>) /tea tea-svc:80 (<none>)
/coffee coffee-svc:80 (<none>) /coffee coffee-svc:80 (<none>)
Annotations: 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: Events:
Type Reason Age From Message Type Reason Age From Message

View file

@ -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: 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 kind: Ingress
metadata: metadata:
name: ingress-myServiceA name: ingress-myServiceA
@ -22,7 +22,7 @@ spec:
serviceName: myServiceA serviceName: myServiceA
servicePort: 80 servicePort: 80
--- ---
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: ingress-myServiceB name: ingress-myServiceB

View file

@ -60,7 +60,7 @@ data:
--- ---
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -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. See the [description](./nginx-configuration/annotations.md#use-regex) of the `use-regex` annotation for more details.
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: test-ingress 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: Let the following two ingress definitions be created:
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: test-ingress-1 name: test-ingress-1
@ -67,7 +67,7 @@ spec:
``` ```
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: test-ingress-2 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: Let the following ingress be defined:
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: test-ingress-3 name: test-ingress-3

View file

@ -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. Using the annotation `nginx.ingress.kubernetes.io/server-snippet` it is possible to add custom configuration in the server configuration block.
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View file

@ -147,7 +147,7 @@ In the Zipkin interface we can see the details:
# Apply the Ingress Resource # Apply the Ingress Resource
$ echo ' $ echo '
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: echo-ingress name: echo-ingress

View file

@ -278,7 +278,7 @@ func runUpdate(ing *ingress.Ingress, status []apiv1.LoadBalancerIngress,
klog.Warningf("error updating ingress rule: %v", err) klog.Warningf("error updating ingress rule: %v", err)
} }
} else { } else {
ingClient := client.ExtensionsV1beta1().Ingresses(ing.Namespace) ingClient := client.NetworkingV1beta1().Ingresses(ing.Namespace)
currIng, err := ingClient.Get(ing.Name, metav1.GetOptions{}) currIng, err := ingClient.Get(ing.Name, metav1.GetOptions{})
if err != nil { if err != nil {
return nil, errors.Wrap(err, fmt.Sprintf("unexpected error searching Ingress %v/%v", ing.Namespace, ing.Name)) return nil, errors.Wrap(err, fmt.Sprintf("unexpected error searching Ingress %v/%v", ing.Namespace, ing.Name))

View file

@ -26,7 +26,7 @@ import (
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/parnurzeal/gorequest" "github.com/parnurzeal/gorequest"
extensions "k8s.io/api/extensions/v1beta1" networking "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "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", "nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
} }
f.EnsureIngress(&extensions.Ingress{ f.EnsureIngress(&networking.Ingress{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: host, Name: host,
Namespace: f.Namespace, Namespace: f.Namespace,
Annotations: annotations, Annotations: annotations,
}, },
Spec: extensions.IngressSpec{ Spec: networking.IngressSpec{
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: host, Host: host,
IngressRuleValue: extensions.IngressRuleValue{ IngressRuleValue: networking.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{ HTTP: &networking.HTTPIngressRuleValue{
Paths: []extensions.HTTPIngressPath{ Paths: []networking.HTTPIngressPath{
{ {
Path: "/something", Path: "/something",
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: framework.EchoService, ServiceName: framework.EchoService,
ServicePort: intstr.FromInt(80), ServicePort: intstr.FromInt(80),
}, },
}, },
{ {
Path: "/somewhereelese", Path: "/somewhereelese",
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: framework.EchoService, ServiceName: framework.EchoService,
ServicePort: intstr.FromInt(80), ServicePort: intstr.FromInt(80),
}, },

View file

@ -22,7 +22,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
extensions "k8s.io/api/extensions/v1beta1" networking "k8s.io/api/networking/v1beta1"
"k8s.io/ingress-nginx/test/e2e/framework" "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") 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" ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/custom-http-errors"] = "503"
return nil return nil
}) })
@ -104,7 +104,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func(
customDefaultBackend := "from-annotation" customDefaultBackend := "from-annotation"
f.NewEchoDeploymentWithNameAndReplicas(customDefaultBackend, 1) 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 ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/default-backend"] = customDefaultBackend
return nil return nil
}) })

View file

@ -25,7 +25,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/parnurzeal/gorequest" "github.com/parnurzeal/gorequest"
extensions "k8s.io/api/extensions/v1beta1" networking "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/ingress-nginx/test/e2e/framework" "k8s.io/ingress-nginx/test/e2e/framework"
) )
@ -62,7 +62,7 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() {
f.EnsureIngress(ing) f.EnsureIngress(ing)
for key, result := range results { 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] ingress.ObjectMeta.Annotations[annotationKey] = annotations[key]
return nil return nil
}) })

View file

@ -24,7 +24,7 @@ import (
"strings" "strings"
"github.com/parnurzeal/gorequest" "github.com/parnurzeal/gorequest"
extensions "k8s.io/api/extensions/v1beta1" networking "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/ingress-nginx/test/e2e/framework" "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", "nginx.ingress.kubernetes.io/proxy-buffer-size": "8k",
} }
ing := &extensions.Ingress{ ing := &networking.Ingress{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "default-backend-annotations", Name: "default-backend-annotations",
Namespace: f.Namespace, Namespace: f.Namespace,
Annotations: annotations, Annotations: annotations,
}, },
Spec: extensions.IngressSpec{ Spec: networking.IngressSpec{
Backend: &extensions.IngressBackend{ Backend: &networking.IngressBackend{
ServiceName: framework.EchoService, ServiceName: framework.EchoService,
ServicePort: intstr.FromInt(80), ServicePort: intstr.FromInt(80),
}, },
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: host, Host: host,
}, },

View file

@ -18,9 +18,10 @@ import (
"strings" "strings"
"time" "time"
"github.com/pkg/errors"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/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" apiextcs "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/fields"
@ -28,8 +29,6 @@ import (
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
restclient "k8s.io/client-go/rest" restclient "k8s.io/client-go/rest"
"github.com/pkg/errors"
"k8s.io/klog" "k8s.io/klog"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
@ -393,8 +392,8 @@ func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name
} }
// UpdateIngress runs the given updateFunc on the ingress // UpdateIngress runs the given updateFunc on the ingress
func UpdateIngress(kubeClientSet kubernetes.Interface, namespace string, name string, updateFunc func(d *extensions.Ingress) error) error { func UpdateIngress(kubeClientSet kubernetes.Interface, namespace string, name string, updateFunc func(d *networking.Ingress) error) error {
ingress, err := kubeClientSet.ExtensionsV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{}) ingress, err := kubeClientSet.NetworkingV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{})
if err != nil { if err != nil {
return err return err
} }
@ -403,37 +402,37 @@ func UpdateIngress(kubeClientSet kubernetes.Interface, namespace string, name st
return err return err
} }
_, err = kubeClientSet.ExtensionsV1beta1().Ingresses(namespace).Update(ingress) _, err = kubeClientSet.NetworkingV1beta1().Ingresses(namespace).Update(ingress)
return err return err
} }
// NewSingleIngressWithTLS creates a simple ingress rule with TLS spec included // 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) return newSingleIngressWithRules(name, path, host, ns, service, port, annotations, tlsHosts)
} }
// NewSingleIngress creates a simple ingress rule // 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) return newSingleIngressWithRules(name, path, host, ns, service, port, annotations, nil)
} }
// NewSingleIngressWithMultiplePaths creates a simple ingress rule with multiple paths // 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 { func NewSingleIngressWithMultiplePaths(name string, paths []string, host, ns, service string, port int, annotations *map[string]string) *networking.Ingress {
spec := extensions.IngressSpec{ spec := networking.IngressSpec{
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: host, Host: host,
IngressRuleValue: extensions.IngressRuleValue{ IngressRuleValue: networking.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{}, HTTP: &networking.HTTPIngressRuleValue{},
}, },
}, },
}, },
} }
for _, path := range paths { 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, Path: path,
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: service, ServiceName: service,
ServicePort: intstr.FromInt(port), ServicePort: intstr.FromInt(port),
}, },
@ -443,18 +442,18 @@ func NewSingleIngressWithMultiplePaths(name string, paths []string, host, ns, se
return newSingleIngress(name, ns, annotations, spec) 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{ spec := networking.IngressSpec{
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: host, Host: host,
IngressRuleValue: extensions.IngressRuleValue{ IngressRuleValue: networking.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{ HTTP: &networking.HTTPIngressRuleValue{
Paths: []extensions.HTTPIngressPath{ Paths: []networking.HTTPIngressPath{
{ {
Path: path, Path: path,
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: service, ServiceName: service,
ServicePort: intstr.FromInt(port), ServicePort: intstr.FromInt(port),
}, },
@ -467,7 +466,7 @@ func newSingleIngressWithRules(name, path, host, ns, service string, port int, a
} }
if len(tlsHosts) > 0 { if len(tlsHosts) > 0 {
spec.TLS = []extensions.IngressTLS{ spec.TLS = []networking.IngressTLS{
{ {
Hosts: tlsHosts, Hosts: tlsHosts,
SecretName: host, 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 // 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 { func NewSingleIngressWithBackendAndRules(name, path, host, ns, defaultService string, defaultPort int, service string, port int, annotations *map[string]string) *networking.Ingress {
spec := extensions.IngressSpec{ spec := networking.IngressSpec{
Backend: &extensions.IngressBackend{ Backend: &networking.IngressBackend{
ServiceName: defaultService, ServiceName: defaultService,
ServicePort: intstr.FromInt(defaultPort), ServicePort: intstr.FromInt(defaultPort),
}, },
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: host, Host: host,
IngressRuleValue: extensions.IngressRuleValue{ IngressRuleValue: networking.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{ HTTP: &networking.HTTPIngressRuleValue{
Paths: []extensions.HTTPIngressPath{ Paths: []networking.HTTPIngressPath{
{ {
Path: path, Path: path,
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: service, ServiceName: service,
ServicePort: intstr.FromInt(port), 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 // NewSingleCatchAllIngress creates a simple ingress with a catch-all backend
func NewSingleCatchAllIngress(name, ns, service string, port int, annotations *map[string]string) *extensions.Ingress { func NewSingleCatchAllIngress(name, ns, service string, port int, annotations *map[string]string) *networking.Ingress {
spec := extensions.IngressSpec{ spec := networking.IngressSpec{
Backend: &extensions.IngressBackend{ Backend: &networking.IngressBackend{
ServiceName: service, ServiceName: service,
ServicePort: intstr.FromInt(port), ServicePort: intstr.FromInt(port),
}, },
@ -519,12 +518,12 @@ func NewSingleCatchAllIngress(name, ns, service string, port int, annotations *m
return newSingleIngress(name, ns, annotations, spec) 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 { if annotations == nil {
annotations = &map[string]string{} annotations = &map[string]string{}
} }
ing := &extensions.Ingress{ ing := &networking.Ingress{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Namespace: ns, Namespace: ns,

View file

@ -26,7 +26,7 @@ import (
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
api "k8s.io/api/core/v1" api "k8s.io/api/core/v1"
core "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" k8sErrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait" "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. // EnsureIngress creates an Ingress object or returns it if it already exists.
func (f *Framework) EnsureIngress(ingress *extensions.Ingress) *extensions.Ingress { func (f *Framework) EnsureIngress(ingress *networking.Ingress) *networking.Ingress {
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Update(ingress) ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(ingress.Namespace).Update(ingress)
if err != nil { if err != nil {
if k8sErrors.IsNotFound(err) { 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") Expect(err).NotTo(HaveOccurred(), "unexpected error creating ingress")
return ing return ing
} }

View file

@ -235,7 +235,7 @@ func WaitForNoIngressInNamespace(c kubernetes.Interface, namespace, name string)
func noIngressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc { func noIngressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
return func() (bool, error) { 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) { if apierrors.IsNotFound(err) {
return true, nil 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 { func ingressInNamespace(c kubernetes.Interface, namespace, name string) wait.ConditionFunc {
return func() (bool, error) { 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) { if apierrors.IsNotFound(err) {
return false, nil return false, nil
} }

View file

@ -104,7 +104,7 @@ func checkIngress(hostname string, f *framework.Framework) {
} }
func deleteIngress(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") Expect(err).NotTo(HaveOccurred(), "unexpected error deleting ingress")
} }

View file

@ -27,7 +27,7 @@ import (
dto "github.com/prometheus/client_model/go" dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt" "github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model" "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" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/ingress-nginx/test/e2e/framework" "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() { It("picks up the certificate when we add TLS spec to existing ingress", func() {
ensureIngress(f, host, framework.EchoService) 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()) Expect(err).ToNot(HaveOccurred())
ing.Spec.TLS = []extensions.IngressTLS{ ing.Spec.TLS = []networking.IngressTLS{
{ {
Hosts: []string{host}, Hosts: []string{host},
SecretName: host, SecretName: host,
@ -57,7 +57,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
ing.Spec.TLS[0].SecretName, ing.Spec.TLS[0].SecretName,
ing.Namespace) ing.Namespace)
Expect(err).ToNot(HaveOccurred()) 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()) Expect(err).ToNot(HaveOccurred())
time.Sleep(waitForLuaSync) time.Sleep(waitForLuaSync)
@ -143,7 +143,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
}) })
It("picks up the updated certificate without reloading", 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()) Expect(err).ToNot(HaveOccurred())
ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host) 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() { 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) 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() { It("picks up a non-certificate only change", func() {
newHost := "foo2.com" 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()) Expect(err).NotTo(HaveOccurred())
ing.Spec.Rules[0].Host = newHost 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()) Expect(err).ToNot(HaveOccurred())
time.Sleep(waitForLuaSync) time.Sleep(waitForLuaSync)
@ -222,10 +222,10 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
}) })
It("removes HTTPS configuration when we delete TLS spec", 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()) Expect(err).NotTo(HaveOccurred())
ing.Spec.TLS = []extensions.IngressTLS{} ing.Spec.TLS = []networking.IngressTLS{}
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ing) _, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Update(ing)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
time.Sleep(waitForLuaSync) time.Sleep(waitForLuaSync)

View file

@ -27,7 +27,7 @@ import (
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/parnurzeal/gorequest" "github.com/parnurzeal/gorequest"
extensions "k8s.io/api/extensions/v1beta1" networking "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/ingress-nginx/internal/nginx" "k8s.io/ingress-nginx/internal/nginx"
@ -146,11 +146,11 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
return true 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()) Expect(err).ToNot(HaveOccurred())
ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/load-balance"] = "round_robin" 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()) Expect(err).ToNot(HaveOccurred())
time.Sleep(waitForLuaSync) 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) ing := createIngress(f, host, deploymentName)
time.Sleep(waitForLuaSync) time.Sleep(waitForLuaSync)
ensureRequest(f, host) ensureRequest(f, host)
@ -192,7 +192,7 @@ func ensureIngress(f *framework.Framework, host string, deploymentName string) *
return ing 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, 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"}))

View file

@ -14,11 +14,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
KIND_LOG_LEVEL="info" KIND_LOG_LEVEL="0"
if ! [ -z $DEBUG ]; then if ! [ -z $DEBUG ]; then
set -x set -x
KIND_LOG_LEVEL="debug" KIND_LOG_LEVEL="6"
fi fi
set -o errexit set -o errexit
@ -41,7 +41,7 @@ export TAG=dev
export ARCH=amd64 export ARCH=amd64
export REGISTRY=ingress-controller 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" 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}" export KUBECONFIG="${HOME}/.kube/kind-config-${KIND_CLUSTER_NAME}"
kind create cluster \ kind create cluster \
--loglevel=${KIND_LOG_LEVEL} \ --verbosity=${KIND_LOG_LEVEL} \
--name ${KIND_CLUSTER_NAME} \ --name ${KIND_CLUSTER_NAME} \
--config ${DIR}/kind.yaml \ --config ${DIR}/kind.yaml \
--image "kindest/node:${K8S_VERSION}" --image "kindest/node:${K8S_VERSION}"
@ -59,15 +59,13 @@ kind create cluster \
echo "Kubernetes cluster:" echo "Kubernetes cluster:"
kubectl get nodes -o wide kubectl get nodes -o wide
kubectl config set-context kubernetes-admin@${KIND_CLUSTER_NAME}
echo "[dev-env] building container" echo "[dev-env] building container"
echo " echo "
make -C ${DIR}/../../ build container make -C ${DIR}/../../ build container
make -C ${DIR}/../../ e2e-test-image make -C ${DIR}/../../ e2e-test-image
make -C ${DIR}/../../images/fastcgi-helloserver/ build container make -C ${DIR}/../../images/fastcgi-helloserver/ build container
make -C ${DIR}/../../images/httpbin/ 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 # 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} 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}" ${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}" openresty/openresty:1.15.8.2-alpine
kind load docker-image --name="${KIND_CLUSTER_NAME}" ${REGISTRY}/httpbin:${TAG} 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..." echo "[dev-env] running e2e tests..."
make -C ${DIR}/../../ e2e-test make -C ${DIR}/../../ e2e-test
kind delete cluster \ kind delete cluster \
--loglevel=${KIND_LOG_LEVEL} \ --verbosity=${KIND_LOG_LEVEL} \
--name ${KIND_CLUSTER_NAME} --name ${KIND_CLUSTER_NAME}

View file

@ -25,7 +25,7 @@ import (
"github.com/parnurzeal/gorequest" "github.com/parnurzeal/gorequest"
corev1 "k8s.io/api/core/v1" 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" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "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" backendService := "nonexistent-svc"
return &extensions.Ingress{ return &networking.Ingress{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: host, Name: host,
Namespace: namespace, Namespace: namespace,
}, },
Spec: extensions.IngressSpec{ Spec: networking.IngressSpec{
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: host, Host: host,
IngressRuleValue: extensions.IngressRuleValue{ IngressRuleValue: networking.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{ HTTP: &networking.HTTPIngressRuleValue{
Paths: []extensions.HTTPIngressPath{ Paths: []networking.HTTPIngressPath{
{ {
Path: path, Path: path,
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: backendService, ServiceName: backendService,
ServicePort: intstr.FromInt(80), 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" backendService := "unavailable-svc"
return &extensions.Ingress{ return &networking.Ingress{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: host, Name: host,
Namespace: namespace, Namespace: namespace,
}, },
Spec: extensions.IngressSpec{ Spec: networking.IngressSpec{
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: host, Host: host,
IngressRuleValue: extensions.IngressRuleValue{ IngressRuleValue: networking.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{ HTTP: &networking.HTTPIngressRuleValue{
Paths: []extensions.HTTPIngressPath{ Paths: []networking.HTTPIngressPath{
{ {
Path: path, Path: path,
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: backendService, ServiceName: backendService,
ServicePort: intstr.FromInt(80), ServicePort: intstr.FromInt(80),
}, },

View file

@ -25,7 +25,7 @@ import (
"github.com/parnurzeal/gorequest" "github.com/parnurzeal/gorequest"
appsv1 "k8s.io/api/apps/v1" 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/apimachinery/pkg/util/intstr"
"k8s.io/ingress-nginx/test/e2e/framework" "k8s.io/ingress-nginx/test/e2e/framework"
@ -88,9 +88,9 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
Expect(errs).To(BeNil()) Expect(errs).To(BeNil())
Expect(resp.StatusCode).Should(Equal(http.StatusOK)) 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.Rules = nil
ingress.Spec.Backend = &extensions.IngressBackend{ ingress.Spec.Backend = &networking.IngressBackend{
ServiceName: framework.EchoService, ServiceName: framework.EchoService,
ServicePort: intstr.FromInt(80), ServicePort: intstr.FromInt(80),
} }

View file

@ -26,7 +26,7 @@ import (
"github.com/parnurzeal/gorequest" "github.com/parnurzeal/gorequest"
corev1 "k8s.io/api/core/v1" 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" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/ingress-nginx/test/e2e/framework" "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 { func buildBasicAuthIngressWithSecondPath(host, namespace, secretName, pathName string) *networking.Ingress {
return &extensions.Ingress{ return &networking.Ingress{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: host, Name: host,
Namespace: namespace, Namespace: namespace,
@ -114,23 +114,23 @@ func buildBasicAuthIngressWithSecondPath(host, namespace, secretName, pathName s
"nginx.ingress.kubernetes.io/auth-realm": "test auth", "nginx.ingress.kubernetes.io/auth-realm": "test auth",
}, },
}, },
Spec: extensions.IngressSpec{ Spec: networking.IngressSpec{
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: host, Host: host,
IngressRuleValue: extensions.IngressRuleValue{ IngressRuleValue: networking.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{ HTTP: &networking.HTTPIngressRuleValue{
Paths: []extensions.HTTPIngressPath{ Paths: []networking.HTTPIngressPath{
{ {
Path: "/", Path: "/",
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: framework.EchoService, ServiceName: framework.EchoService,
ServicePort: intstr.FromInt(80), ServicePort: intstr.FromInt(80),
}, },
}, },
{ {
Path: pathName, Path: pathName,
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: framework.EchoService, ServiceName: framework.EchoService,
ServicePort: intstr.FromInt(80), ServicePort: intstr.FromInt(80),
}, },

View file

@ -27,7 +27,7 @@ import (
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/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" rbacv1 "k8s.io/api/rbac/v1"
k8sErrors "k8s.io/apimachinery/pkg/api/errors" k8sErrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -44,7 +44,7 @@ var _ = framework.IngressNginxDescribe("Pod Security Policies", func() {
BeforeEach(func() { BeforeEach(func() {
psp := createPodSecurityPolicy() psp := createPodSecurityPolicy()
_, err := f.KubeClientSet.ExtensionsV1beta1().PodSecurityPolicies().Create(psp) _, err := f.KubeClientSet.PolicyV1beta1().PodSecurityPolicies().Create(psp)
if !k8sErrors.IsAlreadyExists(err) { if !k8sErrors.IsAlreadyExists(err) {
Expect(err).NotTo(HaveOccurred(), "creating Pod Security Policy") 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 trueValue := true
return &extensions.PodSecurityPolicy{ return &policyv1beta1.PodSecurityPolicy{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: ingressControllerPSP, Name: ingressControllerPSP,
}, },
Spec: extensions.PodSecurityPolicySpec{ Spec: policyv1beta1.PodSecurityPolicySpec{
AllowPrivilegeEscalation: &trueValue, AllowPrivilegeEscalation: &trueValue,
RequiredDropCapabilities: []corev1.Capability{"All"}, RequiredDropCapabilities: []corev1.Capability{"All"},
RunAsUser: extensions.RunAsUserStrategyOptions{ RunAsUser: policyv1beta1.RunAsUserStrategyOptions{
Rule: "RunAsAny", Rule: "RunAsAny",
}, },
SELinux: extensions.SELinuxStrategyOptions{ SELinux: policyv1beta1.SELinuxStrategyOptions{
Rule: "RunAsAny", Rule: "RunAsAny",
}, },
FSGroup: extensions.FSGroupStrategyOptions{ FSGroup: policyv1beta1.FSGroupStrategyOptions{
Ranges: []extensions.IDRange{ Ranges: []policyv1beta1.IDRange{
{ {
Min: 1, Min: 1,
Max: 65535, Max: 65535,
@ -116,8 +116,8 @@ func createPodSecurityPolicy() *extensions.PodSecurityPolicy {
}, },
Rule: "MustRunAs", Rule: "MustRunAs",
}, },
SupplementalGroups: extensions.SupplementalGroupsStrategyOptions{ SupplementalGroups: policyv1beta1.SupplementalGroupsStrategyOptions{
Ranges: []extensions.IDRange{ Ranges: []policyv1beta1.IDRange{
{ {
Min: 1, Min: 1,
Max: 65535, Max: 65535,

View file

@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Pod Security Policies with volumes", fun
It("should be running with a Pod Security Policy", func() { It("should be running with a Pod Security Policy", func() {
psp := createPodSecurityPolicy() psp := createPodSecurityPolicy()
_, err := f.KubeClientSet.ExtensionsV1beta1().PodSecurityPolicies().Create(psp) _, err := f.KubeClientSet.PolicyV1beta1().PodSecurityPolicies().Create(psp)
if !k8sErrors.IsAlreadyExists(err) { if !k8sErrors.IsAlreadyExists(err) {
Expect(err).NotTo(HaveOccurred(), "creating Pod Security Policy") Expect(err).NotTo(HaveOccurred(), "creating Pod Security Policy")
} }

View file

@ -21,7 +21,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
extensions "k8s.io/api/extensions/v1beta1" networking "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/ingress-nginx/test/e2e/framework" "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() { It("should exists Server header in the response when is enabled", func() {
f.UpdateNginxConfigMapData(serverTokens, "true") f.UpdateNginxConfigMapData(serverTokens, "true")
f.EnsureIngress(&extensions.Ingress{ f.EnsureIngress(&networking.Ingress{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: serverTokens, Name: serverTokens,
Namespace: f.Namespace, Namespace: f.Namespace,
Annotations: map[string]string{}, Annotations: map[string]string{},
}, },
Spec: extensions.IngressSpec{ Spec: networking.IngressSpec{
Rules: []extensions.IngressRule{ Rules: []networking.IngressRule{
{ {
Host: serverTokens, Host: serverTokens,
IngressRuleValue: extensions.IngressRuleValue{ IngressRuleValue: networking.IngressRuleValue{
HTTP: &extensions.HTTPIngressRuleValue{ HTTP: &networking.HTTPIngressRuleValue{
Paths: []extensions.HTTPIngressPath{ Paths: []networking.HTTPIngressPath{
{ {
Path: "/", Path: "/",
Backend: extensions.IngressBackend{ Backend: networking.IngressBackend{
ServiceName: framework.EchoService, ServiceName: framework.EchoService,
ServicePort: intstr.FromInt(80), ServicePort: intstr.FromInt(80),
}, },

View file

@ -87,11 +87,11 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() {
err = cmd.Process.Kill() err = cmd.Process.Kill()
Expect(err).NotTo(HaveOccurred(), "unexpected error terminating kubectl proxy") 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) Expect(err).NotTo(HaveOccurred(), "unexpected error getting %s/%v Ingress", f.Namespace, host)
ing.Status.LoadBalancer.Ingress = []apiv1.LoadBalancerIngress{} 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") Expect(err).NotTo(HaveOccurred(), "unexpected error cleaning Ingress status")
time.Sleep(10 * time.Second) 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) { 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 { if err != nil {
return false, nil return false, nil
} }