Skip to content
A Cron Connector for OpenFaaS
Go Shell Smarty Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
chart/cron-connector
sample
travis
types
vendor
yaml
.gitignore
.travis.yml
Dockerfile
Dockerfile.cross
Gopkg.lock
Gopkg.toml
LICENSE
README.md
main.go
main_test.go

README.md

A Cron Connector for OpenFaaS

This is a cron event connector for OpenFaaS. This was built to provide a timer interface to trigger OpenFaaS functions. Also checkout OpenFaas docs on cron for other methods on how you can run functions triggered by cron.

How to Use

You need to have OpenFaaS deployed first, see https://docs.openfaas.com to get started

Works with both armd64 and armhf (Raspberry Pi).

  1. For Docker Swarm:
curl -s https://raw.githubusercontent.com/zeerorg/cron-connector/master/yaml/docker-compose.yml | docker stack deploy func -c -
  1. For Kubernetes:
curl -s https://raw.githubusercontent.com/zeerorg/cron-connector/master/yaml/kubernetes/connector-dep.yml | kubectl create --namespace openfaas -f -

Adding function

The function should have 2 annotations:

  1. topic annotation should be cron-function.
  2. schedule annotation should be the cron schedule on which to invoke function

For example, we may have a function "nodeinfo" which we want to invoke every 5 minutes:

functions:
  nodeinfo:
    image: functions/nodeinfo
    annotations:
      topic: cron-function
      schedule: "*/5 * * * *"

You can learn how to create and test the Cron syntax here.

See the full example here: sample/stack.yml

You can’t perform that action at this time.