Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lionelvillard/knative-functions

A collection of Knative functions
https://github.com/lionelvillard/knative-functions

Last synced: 23 days ago
JSON representation

A collection of Knative functions

Awesome Lists containing this project

README

        

# Knative Eventing Functions
[![Build Status](https://travis-ci.org/lionelvillard/knative-functions.svg?branch=master)](https://travis-ci.org/lionelvillard/knative-functions)

This project provides a collection of functions manipulating [Cloud Events](https://cloudevents.io).

All functions are currently only _callable_ (synchronous). We are planning to add _composable_ (asynchronous) functions
the near future.

## Installation

You first need to install the [Knative Eventing Function Controller](https://github.com/lionelvillard/knative-functions-controller):

```sh
kubectl apply -f https://github.com/lionelvillard/knative-functions-controller/releases/download/v0.1.2/function.yaml
```

Then install the function library:

```sh
kubectl apply -f https://github.com/lionelvillard/knative-functions/releases/download/v0.2.0/functions.yaml
```

## Functions

The functions are:

- [Wait](#wait)
- [Filter](#filter)

### Wait

The `Wait` function forward events after X seconds.

#### Example

```yaml
apiVersion: functions.knative.dev/v1alpha1
kind: Wait
metadata:
name: wait-5
spec:
seconds: 5
```

### Filter

A filter takes a cloud event as input, evaluates a predicate against it and returns the
unmodified event when the predicate return true, otherwise returns an empty response.

The predicate must be a Javascript expression. It is evaluated in a sandbox with the variable [`event`](https://github.com/cloudevents/spec/blob/v1.0/json-format.md)

### Example

```yaml
apiVersion: functions.knative.dev/v1alpha1
kind: Filter
metadata:
name: filter
spec:
expression: event.data.assigned
```