Switch to another 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.

For example, you can choose to use Istio as the underlying Kubernetes Gateway like this:

  1. Install OpenFunction without Contour:
  1. helm install openfunction --set global.Contour.enabled=false openfunction/openfunction -n openfunction
  1. Install Istio and then enable its Knative integration:
  1. kubectl apply -l knative.dev/crd-install=true -f https://github.com/knative/net-istio/releases/download/knative-v1.3.0/istio.yaml
  2. kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v1.3.0/istio.yaml
  3. kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v1.3.0/net-istio.yaml
  1. Create a GatewayClass named istio:
  1. kubectl apply -f - <<EOF
  2. apiVersion: gateway.networking.k8s.io/v1alpha2
  3. kind: GatewayClass
  4. metadata:
  5. name: istio
  6. spec:
  7. controllerName: istio.io/gateway-controller
  8. description: The default Istio GatewayClass
  9. EOF
  1. Create an OpenFunction Gateway:
  1. kubectl apply -f - <<EOF
  2. apiVersion: networking.openfunction.io/v1alpha1
  3. kind: Gateway
  4. metadata:
  5. name: custom-gateway
  6. namespace: openfunction
  7. spec:
  8. domain: ofn.io
  9. clusterDomain: cluster.local
  10. hostTemplate: "{{.Name}}.{{.Namespace}}.{{.Domain}}"
  11. pathTemplate: "{{.Namespace}}/{{.Name}}"
  12. gatewayDef:
  13. namespace: openfunction
  14. gatewayClassName: istio
  15. gatewaySpec:
  16. listeners:
  17. - name: ofn-http-external
  18. protocol: HTTP
  19. port: 80
  20. allowedRoutes:
  21. namespaces:
  22. from: All
  23. EOF
  1. Reference the custom OpenFunction Gateway (Istio) in the gatewayRef field of a Function:
  1. kubectl apply -f - <<EOF
  2. apiVersion: core.openfunction.io/v1beta2
  3. kind: Function
  4. metadata:
  5. name: function-sample
  6. spec:
  7. version: "v1.0.0"
  8. image: "openfunctiondev/v1beta1-http:latest"
  9. serving:
  10. template:
  11. containers:
  12. - name: function
  13. imagePullPolicy: Always
  14. triggers:
  15. http:
  16. route:
  17. gatewayRef:
  18. name: custom-gateway
  19. namespace: openfunction
  20. EOF