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

@ -30,9 +30,8 @@ import (
jsoniter "github.com/json-iterator/go"
apiv1 "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/ingress-nginx/internal/ingress"
"k8s.io/ingress-nginx/internal/ingress/annotations/authreq"
@ -55,6 +54,8 @@ func init() {
}
var (
pathPrefix networking.PathType = networking.PathTypePrefix
// TODO: add tests for SSLPassthrough
tmplFuncTestcases = map[string]struct {
Path string
@ -197,11 +198,11 @@ func TestBuildLuaSharedDictionaries(t *testing.T) {
servers := []*ingress.Server{
{
Hostname: "foo.bar",
Locations: []*ingress.Location{{Path: "/"}},
Locations: []*ingress.Location{{Path: "/", PathType: &pathPrefix}},
},
{
Hostname: "another.host",
Locations: []*ingress.Location{{Path: "/"}},
Locations: []*ingress.Location{{Path: "/", PathType: &pathPrefix}},
},
}
// returns value from config
@ -283,8 +284,9 @@ func TestBuildLocation(t *testing.T) {
for k, tc := range tmplFuncTestcases {
loc := &ingress.Location{
Path: tc.Path,
Rewrite: rewrite.Config{Target: tc.Target},
Path: tc.Path,
PathType: &pathPrefix,
Rewrite: rewrite.Config{Target: tc.Target},
}
newLoc := buildLocation(loc, tc.enforceRegex)
@ -301,6 +303,7 @@ func TestBuildProxyPass(t *testing.T) {
for k, tc := range tmplFuncTestcases {
loc := &ingress.Location{
Path: tc.Path,
PathType: &pathPrefix,
Rewrite: rewrite.Config{Target: tc.Target},
Backend: defaultBackend,
XForwardedPrefix: tc.XForwardedPrefix,
@ -828,6 +831,7 @@ func TestBuildUpstreamName(t *testing.T) {
for k, tc := range tmplFuncTestcases {
loc := &ingress.Location{
Path: tc.Path,
PathType: &pathPrefix,
Rewrite: rewrite.Config{Target: tc.Target},
Backend: defaultBackend,
XForwardedPrefix: tc.XForwardedPrefix,
@ -937,8 +941,10 @@ func TestGetIngressInformation(t *testing.T) {
},
},
Spec: networking.IngressSpec{
Backend: &networking.IngressBackend{
ServiceName: "a-svc",
DefaultBackend: &networking.IngressBackend{
Service: &networking.IngressServiceBackend{
Name: "a-svc",
},
},
},
},
@ -948,6 +954,7 @@ func TestGetIngressInformation(t *testing.T) {
&ingressInformation{
Namespace: "default",
Rule: "validIng",
Path: "/",
Annotations: map[string]string{
"ingress.annotation": "ok",
},
@ -972,10 +979,15 @@ func TestGetIngressInformation(t *testing.T) {
HTTP: &networking.HTTPIngressRuleValue{
Paths: []networking.HTTPIngressPath{
{
Path: "/ok",
Path: "/ok",
PathType: &pathPrefix,
Backend: networking.IngressBackend{
ServiceName: "b-svc",
ServicePort: intstr.FromInt(80),
Service: &networking.IngressServiceBackend{
Name: "b-svc",
Port: networking.ServiceBackendPort{
Number: 80,
},
},
},
},
},
@ -1249,7 +1261,8 @@ func TestEnforceRegexModifier(t *testing.T) {
Target: "/alright",
UseRegex: true,
},
Path: "/ok",
Path: "/ok",
PathType: &pathPrefix,
},
}
expected = true