---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/version: latest
  name: openfunction-config
  namespace: openfunction
data:
  # Tell OpenFunction the namespace where knative-serving is located
  knative-serving.namespace: "knative-serving"
  # Tell OpenFunction the name of the ConfigMap of the knative-serving's configuration
  knative-serving.config-features.name: "config-features"
  # Configuration of the tracing of functions
  plugins.tracing: |
    enabled: false
    # Provider name can be set to "skywalking", "opentelemetry"
    # A valid provider must be set if tracing is enabled.
    provider:
      name: "skywalking"
      oapServer: "localhost:xxx"
    # Custom tags to add to tracing
    tags:
      func: function-with-tracing
      layer: faas
      tag1: value1
      tag2: value2
    baggage:
    # baggage key is `sw8-correlation` for skywalking and `baggage` for opentelemetry
    # Correlation context for skywalking: https://skywalking.apache.org/docs/main/latest/en/protocols/skywalking-cross-process-correlation-headers-protocol-v1/
    # baggage for opentelemetry: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/baggage/api.md
    # W3C Baggage Specification/: https://w3c.github.io/baggage/
      key: sw8-correlation # key should be baggage for opentelemetry
      value: "base64(string key):base64(string value),base64(string key2):base64(string value2)"
  # The following is a sample configuration
  _example: |
    knative-serving.namespace: "knative-serving"
    knative-serving.config-features.name: "config-features"
    # Configuration of the order of the plugins
    plugins: |
      pre:
      - plugin1
      - plugin2
      post:
      - plugin2
      - plugin1
    plugins.tracing: |
      # Switch for tracing, default to false
      enabled: true
      # Provider name can be set to "skywalking", "opentelemetry"
      # A valid provider must be set if tracing is enabled.
      provider:
        name: "skywalking"
        oapServer: "localhost:xxx"
      # Custom tags to add to tracing
      tags:
        func: function-with-tracing
        layer: faas
        tag1: value1
        tag2: value2
      baggage:
      # baggage key is `sw8-correlation` for skywalking and `baggage` for opentelemetry
      # Correlation context for skywalking: https://skywalking.apache.org/docs/main/latest/en/protocols/skywalking-cross-process-correlation-headers-protocol-v1/
      # baggage for opentelemetry: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/baggage/api.md
      # W3C Baggage Specification/: https://w3c.github.io/baggage/
        key: sw8-correlation # key should be baggage for opentelemetry
        value: "base64(string key):base64(string value),base64(string key2):base64(string value2)"
