Repository: fission/fission (language: go)

Issue:
Unable to create ingress route inside Google Kubernetes Engine
<!-- Please answer these questions before submitting your issue. Thanks! -->

<!-- Documentation URL: https://docs.fission.io/ -->
<!-- Troubleshooting guide: https://docs.fission.io/trouble-shooting/ -->

**Fission/Kubernetes version**

<!-- If you tested with other services, for example Istio, please also provide the version of service as well. -->

<pre>
$ fission --version

client:
  fission/core:
    BuildDate: "2021-08-02T11:44:22Z"
    GitCommit: f4702fe066c48e05cd5c093311fe95e4a6a971a4
    Version: 1.14.0
server:
  fission/core:
    BuildDate: "2021-08-02T09:30:56Z"
    GitCommit: f4702fe066c48e05cd5c093311fe95e4a6a971a4
    Version: 1.14.0

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.3", GitCommit:"ca643a4d1f7bfe34773c74f79527be4afd95bf39", GitTreeState:"clean", BuildDate:"2021-07-15T21:04:39Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.8-gke.900", GitCommit:"28ab8501be88ea42e897ca8514d7cd0b436253d9", GitTreeState:"clean", BuildDate:"2021-06-30T09:23:36Z", GoVersion:"go1.15.13b5", Compiler:"gc", Platform:"linux/amd64"}
</pre>

**Kubernetes platform (e.g. Google Kubernetes Engine)**
Google Kubernetes Engine

**Describe the bug**
```bash
fission route create --url /hello --function hello --createingress
```

Trying to create route with `--createingress` passes with success from Fission CLI but when i open `router` pod inside Google Cloud Engine i can see in the logs that error message appears  `error: Ingress.extensions "daa2b59c-d841-4a47-824e-7a460e810aee" is invalid: spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified`

Full error message:

```
2021-08-03 13:13:16.955 EEST{caller: router/ingress.go:48, error: Ingress.extensions "daa2b59c-d841-4a47-824e-7a460e810aee" is invalid: spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified, level: error, logger: triggerset.http_trigger_set, msg: failed to create ingress, ts: 2021-08-03T10:13:16.955Z…
```
![Screenshot from 2021-08-03 13-23-37](https://user-images.githubusercontent.com/19847933/128000708-36c6a180-5130-4a87-a548-270643efbfcb.png)


**To Reproduce**

Create Google Kubernetes Cluster and try to create route with ingress in mind then go to router pod and watch for logs

**Expected result**
To not have error inside router and to create ingress route

**Additional Notes**

I have installed `ingress` using the link provided in the [Documentation](https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke) especially for GKE 

Here is the output of `kubectl get all -n ingress-nginx`

```
NAME                                           READY   STATUS      RESTARTS   AGE
pod/ingress-nginx-admission-create-wc6v2       0/1     Completed   0          88m
pod/ingress-nginx-admission-patch-9gwhl        0/1     Completed   1          88m
pod/ingress-nginx-controller-b65df6fbb-r2x7f   1/1     Running     0          88m

NAME                                         TYPE           CLUSTER-IP    EXTERNAL-IP   PORT(S)                      AGE
service/ingress-nginx-controller             LoadBalancer   10.104.6.69   **.**.**.**   80:30248/TCP,443:31316/TCP   88m
service/ingress-nginx-controller-admission   ClusterIP      10.104.6.1    <none>        443/TCP                      88m

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/ingress-nginx-controller   1/1     1            1           88m

NAME                                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/ingress-nginx-controller-b65df6fbb   1         1         1       88m

NAME                                       COMPLETIONS   DURATION   AGE
job.batch/ingress-nginx-admission-create   1/1           6s         88m
job.batch/ingress-nginx-admission-patch    1/1           7s         88m
```



Discussion / hints:
I have the same issue when I use `fission-1.14.1` with Kind. Looks like it is caused by the Ingress upgrade from v1beta1 to v1.
I think add `PathType` here can fix the issue:
https://github.com/fission/fission/blob/ba7ee3ed9566351024a43b0f33628a4965937b36/pkg/router/util/util.go#L83

And the reference from k8s client-go:
https://pkg.go.dev/k8s.io/api/networking/v1#HTTPIngressPath


Fix patch:
diff --git a/pkg/router/util/util.go b/pkg/router/util/util.go
index 104c1e646e..3154999cbf 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,
 								},
 							},
 						},


Test patch:
diff --git a/pkg/router/util/util_test.go b/pkg/router/util/util_test.go
index ac3762d864..185a6001f2 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,
 										},
 									},
 								},