Skip to content

Commit

Permalink
Minor updates and fixes to functions docs (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcx authored and sameersbn committed Jun 8, 2023
1 parent 3608c75 commit 8dd6f44
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
14 changes: 14 additions & 0 deletions docs/transformation/functions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,17 @@ For low-code style transformations in JSON, refer to [JSON Transformation](../js
TriggerMesh functions with `tmctl` is a work in progress and not currently supported.

Furthermore, note that TriggerMesh Functions are opinionated and simple. They are aimed to be used for event transformation and do not support external dependencies. Functions that may need external dependencies are best served with something like AWS Lambda or [Knative Functions](https://knative.dev/docs/functions/).

See the [Kubernetes object reference](../../reference/extensions/#extensions.triggermesh.io/v1alpha1.Function) for the Function reference docs.

## Common function configuration options

Below are some parameters you can configure in the function CRD, that apply to all function runtimes.

| Parameter | Description |
| ------------------------- | ------------------------------------------------------------ |
| `adapterOverrides.public` | Boolean. If true, function will be allocated a public URL so that it can be accessed from outside the cluster. Default is false. |
| `ceOverrides.extensions` | Can be used to modify the values of CloudEvents attributes in the event return by the function back to the caller. |
| `responseIsEvent` | Boolean. If false, the function will wrap what is returned by the function into the `data` attribute of a CloudEvent and respond back to the caller with it. It will add default CloudEvent metadata attributes, unless values are overriden in `ceOverrides`. If true, expects the user to have returned a complete CloudEvent object, and will no wrap it into the `data` attribute of a new CloudEvent. |
| `entrypoint` | Name of the function to be used as an entry point in the code. |
| `runtime` | Currently supported runtime values are `python`, `node`, and `ruby`. |
2 changes: 2 additions & 0 deletions docs/transformation/functions/nodejsfunctions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# NodeJS functions

For information about configuration options across all function runtimes, please head to the [main functions documentation page](index.md).

## NodeJS empty field transformation example on Kubernetes

```yaml
Expand Down
7 changes: 5 additions & 2 deletions docs/transformation/functions/pythonfunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ metadata:
name: python-function-hello
spec:
runtime: python
public: true
adapterOverrides:
public: true
entrypoint: endpoint
code: |
import json
def endpoint(event, context):
return "Hello " + event['name']
jsonEvent = json.loads(event)
return "Hello " + jsonEvent['name']
```
You can then create the function with:
Expand Down
2 changes: 2 additions & 0 deletions docs/transformation/functions/rubyfunctions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Ruby functions

For information about configuration options across all function runtimes, please head to the [main functions documentation page](index.md).

## Ruby date and time event example on Kubernetes

```YAML
Expand Down

0 comments on commit 8dd6f44

Please sign in to comment.