OpenFunction: Apisix & Gateway API is not working.

Description I am trying to configure openfunction working with apisix and gateway api. I was able to create a simple route with the echo server to check if apisix & gateway api is working.

Now i am stuck with OpenFunction.

Environmental

  • Operating System Information: ubuntu
  • kubernetes version: lastest (with minikube)
  • OpenFunction version: lastest

Expected behavior Request the function

Actual behavior Get this error

curl -i $SERVICE_IP/v2/foo/world -H 'Host: sample.ofn.io'
HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
Content-Length: 73
Connection: keep-alive
X-Content-Type-Options: nosniff
Date: Tue, 30 Aug 2022 21:41:02 GMT
Server: APISIX/2.15.0

Error getting active endpoint: revision.serving.knative.dev "" not found

To Reproduce Steps to reproduce the behavior:

  1. Install apisix with ingress and Gateway api enable (v1.5.0)
helm install openfunction openfunction/openfunction \
  -n openfunction \
  --set global.Contour.enabled=false
kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: GatewayClass
metadata:
  name: apisix-lb
spec:
  controllerName: apisix.apache.org/gateway-controller
EOF
kubectl apply -f - <<EOF
apiVersion: networking.openfunction.io/v1alpha1
kind: Gateway
metadata:
  name: openfunction-gateway
  namespace: default
spec:
  domain: ofn.io
  clusterDomain: cluster.local
  hostTemplate: "{{.Name}}.{{.Namespace}}.{{.Domain}}"
  pathTemplate: "{{.Namespace}}/{{.Name}}"
  httpRouteLabelKey: "app.kubernetes.io/managed-by"
  gatewayDef:
    namespace: default
    gatewayClassName: apisix-lb
  gatewaySpec:
    listeners:
      - name: ofn-http-internal
        hostname: "*.cluster.local"
        protocol: HTTP
        port: 80
        allowedRoutes:
          namespaces:
            from: All
      - name: ofn-http-external
        hostname: "*.ofn.io"
        protocol: HTTP
        port: 80
        allowedRoutes:
          namespaces:
            from: All
EOF
kubectl apply -f - <<EOF
apiVersion: core.openfunction.io/v1beta1
kind: Function
metadata:
  name: function-sample
spec:
  version: "v2.0.0"
  image: "localrepo/sample-go-func:v1"  
  imageCredentials:
    name: push-secret
  port: 8080 # default to 8080
  build:
    builder: openfunction/builder-go:latest
    env:
      FUNC_NAME: "HelloWorld"
      FUNC_CLEAR_SOURCE: "true"
    srcRepo:
      url: "https://github.com/OpenFunction/samples.git"
      sourceSubPath: "functions/knative/hello-world-go"
      revision: "main"
  serving:
    template:
      containers:
        - name: function # DO NOT change this
          imagePullPolicy: IfNotPresent 
    runtime: "knative"
  route:
    gatewayRef:
      name: openfunction-gateway
      namespace: default
    rules:
      - matches:
          - path:
              type: PathPrefix
              value: /v2/foo      
    hostnames:
    - "sample.ofn.io"      
EOF
  1. See the error
export SERVICE_IP=$(kubectl get svc --namespace ingress-apisix apisix-gateway --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
curl -i $SERVICE_IP/v2/foo/world -H 'Host: sample.ofn.io'

HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
Content-Length: 73
Connection: keep-alive
X-Content-Type-Options: nosniff
Date: Tue, 30 Aug 2022 21:41:02 GMT
Server: APISIX/2.15.0

Error getting active endpoint: revision.serving.knative.dev "" not found

Screenshots

We can see the service:

Screen Shot 2022-08-30 at 5 44 57 PM

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Will be implemented soon, but since the development window for APISIX Ingress v1.5 has been closed, this feature will be carried over to v1.6

yeah, I will try to create native k8s gateway & httproute and knative service directly without OpenFunction. If it still does not work, I think need to check how apisix implements Gateway API.

Yeah,and we can install a separate controller(Kourier) for Knative , if this works, i will update the documentation after testing with apisix-ingress-controller v1.5.0-rc.1.