OpenFunction Gateway

Inside OpenFunction Gateway

Backed by the Kubernetes Gateway, an OpenFunction Gateway defines how users can access sync functions.

Whenever an OpenFunction Gateway is created, the gateway controller will:

  • Add a default listener named ofn-http-internal to gatewaySpec.listeners if there isn’t one there.

  • Generate gatewaySpec.listeners.[*].hostname based on domain or clusterDomain.

  • Inject gatewaySpec.listenters to the existing Kubernetes Gateway defined by the gatewayRef of the OpenFunction Gateway.

  • Create an new Kubernetes Gateway based on the gatewaySpec.listenters field in gatewayDef of the OpenFunction Gateway.

  • Create a service named gateway.openfunction.svc.cluster.local that defines a unified entry for sync functions.

After an OpenFunction Gateway is deployed, you’ll be able to find the status of Kubernetes Gateway and its listeners in OpenFunction Gateway status:

  1. status:
  2. conditions:
  3. - message: Gateway is scheduled
  4. reason: Scheduled
  5. status: "True"
  6. type: Scheduled
  7. - message: Valid Gateway
  8. reason: Valid
  9. status: "True"
  10. type: Ready
  11. listeners:
  12. - attachedRoutes: 0
  13. conditions:
  14. - message: Valid listener
  15. reason: Ready
  16. status: "True"
  17. type: Ready
  18. name: ofn-http-internal
  19. supportedKinds:
  20. - group: gateway.networking.k8s.io
  21. kind: HTTPRoute
  22. - attachedRoutes: 0
  23. conditions:
  24. - message: Valid listener
  25. reason: Ready
  26. status: "True"
  27. type: Ready
  28. name: ofn-http-external
  29. supportedKinds:
  30. - group: gateway.networking.k8s.io
  31. kind: HTTPRoute

The Default OpenFunction Gateway

OpenFunction Gateway uses Contour as the default Kubernetes Gateway implementation. The following OpenFunction Gateway will be created automatically once you install OpenFunction:

  1. apiVersion: networking.openfunction.io/v1alpha1
  2. kind: Gateway
  3. metadata:
  4. name: openfunction
  5. namespace: openfunction
  6. spec:
  7. domain: ofn.io
  8. clusterDomain: cluster.local
  9. hostTemplate: "{{.Name}}.{{.Namespace}}.{{.Domain}}"
  10. pathTemplate: "{{.Namespace}}/{{.Name}}"
  11. httpRouteLabelKey: "app.kubernetes.io/managed-by"
  12. gatewayRef:
  13. name: contour
  14. namespace: projectcontour
  15. gatewaySpec:
  16. listeners:
  17. - name: ofn-http-internal
  18. hostname: "*.cluster.local"
  19. protocol: HTTP
  20. port: 80
  21. allowedRoutes:
  22. namespaces:
  23. from: All
  24. - name: ofn-http-external
  25. hostname: "*.ofn.io"
  26. protocol: HTTP
  27. port: 80
  28. allowedRoutes:
  29. namespaces:
  30. from: All

You can customize the default OpenFunction Gateway like below:

  1. kubectl edit gateway openfunction -n openfunction

Switch to a different Kubernetes Gateway

You can switch to any gateway implementations that support Kubernetes Gateway API such as Contour, Istio, Apache APISIX, Envoy Gateway (in the future) and more in an easier and vendor-neutral way.

Here you can find more details.

Multiple OpenFunction Gateway

Multiple Gateway are meaningless for OpenFunction, we currently only support one OpenFunction Gateway.