Drop v1beta1 from ingress nginx (#7156)

* Drop v1beta1 from ingress nginx

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

* Fix intorstr logic in controller

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

* fixing admission

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

* more intorstr fixing

* correct template rendering

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

* Fix e2e tests for v1 api

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

* Fix gofmt errors

* This is finally working...almost there...

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

* Re-add removed validation of AdmissionReview
This commit is contained in:
Ricardo Katz 2021-06-23 18:20:10 -03:00 committed by GitHub
parent a8408cdb51
commit 78afe7e389
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
159 changed files with 1217 additions and 1008 deletions

View file

@ -33,9 +33,8 @@ import (
"github.com/eapache/channels"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1beta1"
networking "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/ingress-nginx/internal/file"
@ -257,7 +256,7 @@ func TestCheckIngress(t *testing.T) {
})
t.Run("When a new catch-all ingress is being created despite catch-alls being disabled ", func(t *testing.T) {
backendBefore := ing.Spec.Backend
backendBefore := ing.Spec.DefaultBackend
disableCatchAllBefore := nginx.cfg.DisableCatchAll
nginx.command = testNginxTestCommand{
@ -266,10 +265,12 @@ func TestCheckIngress(t *testing.T) {
}
nginx.cfg.DisableCatchAll = true
ing.Spec.Backend = &networking.IngressBackend{
ServiceName: "http-svc",
ServicePort: intstr.IntOrString{
IntVal: 80,
ing.Spec.DefaultBackend = &networking.IngressBackend{
Service: &networking.IngressServiceBackend{
Name: "http-svc",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
}
@ -278,7 +279,7 @@ func TestCheckIngress(t *testing.T) {
}
// reset backend and catch-all flag
ing.Spec.Backend = backendBefore
ing.Spec.DefaultBackend = backendBefore
nginx.cfg.DisableCatchAll = disableCatchAllBefore
})
@ -331,10 +332,11 @@ func TestMergeAlternativeBackends(t *testing.T) {
Path: "/",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -415,10 +417,11 @@ func TestMergeAlternativeBackends(t *testing.T) {
Path: "/",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "foo-http-svc-canary",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "foo-http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -435,10 +438,11 @@ func TestMergeAlternativeBackends(t *testing.T) {
Path: "/",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -553,10 +557,11 @@ func TestMergeAlternativeBackends(t *testing.T) {
Path: "/",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -588,10 +593,12 @@ func TestMergeAlternativeBackends(t *testing.T) {
Namespace: "example",
},
Spec: networking.IngressSpec{
Backend: &networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
IntVal: 80,
DefaultBackend: &networking.IngressBackend{
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -656,10 +663,12 @@ func TestMergeAlternativeBackends(t *testing.T) {
Namespace: "example",
},
Spec: networking.IngressSpec{
Backend: &networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
IntVal: 80,
DefaultBackend: &networking.IngressBackend{
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -720,9 +729,11 @@ func TestMergeAlternativeBackends(t *testing.T) {
Path: "/",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1001,10 +1012,12 @@ func TestGetBackendServers(t *testing.T) {
Namespace: "example",
},
Spec: networking.IngressSpec{
Backend: &networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
IntVal: 80,
DefaultBackend: &networking.IngressBackend{
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1044,10 +1057,12 @@ func TestGetBackendServers(t *testing.T) {
Namespace: "example",
},
Spec: networking.IngressSpec{
Backend: &networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
IntVal: 80,
DefaultBackend: &networking.IngressBackend{
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1064,10 +1079,12 @@ func TestGetBackendServers(t *testing.T) {
Namespace: "example",
},
Spec: networking.IngressSpec{
Backend: &networking.IngressBackend{
ServiceName: "http-svc",
ServicePort: intstr.IntOrString{
IntVal: 80,
DefaultBackend: &networking.IngressBackend{
Service: &networking.IngressServiceBackend{
Name: "http-svc",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1117,10 +1134,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1177,10 +1195,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1214,10 +1233,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-canary",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-canary",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1283,10 +1303,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/a",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-1",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-1",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1320,10 +1341,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/a",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-2",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-2",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1357,10 +1379,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/b",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-2",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-2",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1394,10 +1417,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/b",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-1",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-1",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1431,10 +1455,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/c",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-1",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-1",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1468,10 +1493,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/c",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "http-svc-2",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "http-svc-2",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1553,10 +1579,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/path1",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "path1-svc",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "path1-svc",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1593,10 +1620,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/path2",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "path2-svc",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "path2-svc",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1658,10 +1686,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/path1",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "path1-svc",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "path1-svc",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
@ -1698,10 +1727,11 @@ func TestGetBackendServers(t *testing.T) {
Path: "/path2",
PathType: &pathTypePrefix,
Backend: networking.IngressBackend{
ServiceName: "path2-svc",
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: 80,
Service: &networking.IngressServiceBackend{
Name: "path2-svc",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},