BaaS Integration

One of the unique features of OpenFunction is its simple integration with various backend services (BaaS) through Dapr. Currently, OpenFunction supports Dapr pub/sub and bindings building blocks, and more will be added in the future.

In OpenFunction v0.7.0 and versions prior to v0.7.0, OpenFunction integrates with BaaS by injecting a dapr sidecar container into each function instance’s pod, which leads to the following problems:

  • The entire function instance’s launch time is slowed down by the launching of the dapr sidecar container.
  • The dapr sidecar container may consume more resources than the function container itself.

To address the problems above, OpenFunction introduces the Dapr Standalone Mode in v0.8.0.

Dapr Standalone Mode

In Dapr standalone mode, one Dapr Proxy service will be created for each function which is then shared by all instances of this function. This way, there is no need to launch a seperate Dapr sidecar container for each function instance anymore which reduces the function launching time significantly.

Choose the appropriate Dapr Service Mode

So now you’ve 2 options to integrate with BaaS:

  • Dapr Sidecar Mode
  • Dapr Standalone Mode

You can choose the appropriate Dapr Service Mode for your functions. The Dapr Standalone Mode is the recommened and default mode. You can use Dapr Sidecar Mode if your function doesn’t scale frequently or you’ve difficulty to use the Dapr Standalone Mode.

You can control how to integrate with BaaS with 2 flags, both can be set in function’s spec.serving.annotations:

  • can be set to true or false
  • can be set to standalone or sidecar
  • When is set to true, users can choose the Dapr Service Mode by setting to standalone or sidecar.
  • When is set to false, the value of will be ignored and neither Dapr Sidecar nor Dapr Proxy Service will be launched.

There’re default values for both of these two flags if they’re not set.

  • The value of will be set to true if it’s not defined in spec.serving.annotations and the function definition contains either spec.serving.inputs or spec.serving.outputs. Otherwise it will be set to false.
  • The default value of is standalone if not set.

Below you can find a function example to set these two flags:

kind: Function
  name: cron-input-kafka-output
  version: "v2.0.0"
  image: openfunctiondev/cron-input-kafka-output:v1
    name: push-secret
    builder: openfunction/builder-go:latest
      FUNC_NAME: "HandleCronInput"
      FUNC_CLEAR_SOURCE: "true"
      url: ""
      sourceSubPath: "functions/async/bindings/cron-input-kafka-output"
      revision: "main"
    annotations: "true" "standalone"
        - name: function # DO NOT change this
          imagePullPolicy: IfNotPresent 
    runtime: "async"
      - name: cron
        component: cron
      - name: sample
        component: kafka-server
        operation: "create"
        type: bindings.cron
        version: v1
        - name: schedule
          value: "@every 2s"
        type: bindings.kafka
        version: v1
        - name: brokers
          value: "kafka-server-kafka-brokers:9092"
        - name: topics
          value: "sample-topic"
        - name: consumerGroup
          value: "bindings-with-output"
        - name: publishTopic
          value: "sample-topic"
        - name: authRequired
          value: "false"