From c51c6b7f7e885d444825aeb51bd0edf4fa76be29 Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 20 Aug 2021 11:19:55 +0800 Subject: [PATCH] fix: Add pathType to create networking/v1 ingress (#2164) * fix: Add pathType to create networking/v1 ingress Signed-off-by: Sanket Sudake Co-authored-by: Sanket Sudake --- pkg/router/util/util.go | 4 +++- pkg/router/util/util_test.go | 25 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/pkg/router/util/util.go b/pkg/router/util/util.go index 104c1e64..3154999c 100644 --- a/pkg/router/util/util.go +++ b/pkg/router/util/util.go @@ -55,6 +55,7 @@ func GetIngressSpec(namespace string, trigger *fv1.HTTPTrigger) *v1.Ingress { } } + var pathType v1.PathType = v1.PathTypeImplementationSpecific ing := &v1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Labels: GetDeployLabels(trigger), @@ -82,7 +83,8 @@ func GetIngressSpec(namespace string, trigger *fv1.HTTPTrigger) *v1.Ingress { }, }, }, - Path: path, + Path: path, + PathType: &pathType, }, }, }, diff --git a/pkg/router/util/util_test.go b/pkg/router/util/util_test.go index ac3762d8..185a6001 100644 --- a/pkg/router/util/util_test.go +++ b/pkg/router/util/util_test.go @@ -31,6 +31,7 @@ func TestGetIngressSpec(t *testing.T) { ingressNS string trigger *fv1.HTTPTrigger } + var pathType v1.PathType = v1.PathTypeImplementationSpecific tests := []struct { name string args args @@ -84,7 +85,8 @@ func TestGetIngressSpec(t *testing.T) { }, }, }, - Path: "/foo/bar", + Path: "/foo/bar", + PathType: &pathType, }, }, }, @@ -145,7 +147,8 @@ func TestGetIngressSpec(t *testing.T) { }, }, }, - Path: "/foo/bar", + Path: "/foo/bar", + PathType: &pathType, }, }, }, @@ -204,7 +207,8 @@ func TestGetIngressSpec(t *testing.T) { }, }, }, - Path: "/foo/bar", + Path: "/foo/bar", + PathType: &pathType, }, }, }, @@ -263,7 +267,8 @@ func TestGetIngressSpec(t *testing.T) { }, }, }, - Path: "/foo/{bar}", + Path: "/foo/{bar}", + PathType: &pathType, }, }, }, @@ -322,7 +327,8 @@ func TestGetIngressSpec(t *testing.T) { }, }, }, - Path: "/foo/{bar}", + Path: "/foo/{bar}", + PathType: &pathType, }, }, }, @@ -382,7 +388,8 @@ func TestGetIngressSpec(t *testing.T) { }, }, }, - Path: "/foo/bar", + Path: "/foo/bar", + PathType: &pathType, }, }, }, @@ -441,7 +448,8 @@ func TestGetIngressSpec(t *testing.T) { }, }, }, - Path: "/foo/bar", + Path: "/foo/bar", + PathType: &pathType, }, }, }, @@ -512,7 +520,8 @@ func TestGetIngressSpec(t *testing.T) { }, }, }, - Path: "/foo/bar", + Path: "/foo/bar", + PathType: &pathType, }, }, },