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.
This project was forked from zeerorg/cron-connector to enable prompt updates and patches for end-users.
First, deploy OpenFaaS with faasd or Kubernetes
For Kubernetes, see: Scheduling function runs
For faasd, see Serverless For Everyone Else.
The function should have 2 annotations:
topic
annotation should becron-function
.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:
Deploy via the CLI:
faas-cli store deploy nodeinfo \
--annotation schedule="*/5 * * * *" \
--annotation topic=cron-function
Or via stack.yml
:
functions:
nodeinfo:
image: functions/nodeinfo
annotations:
topic: cron-function
schedule: "*/5 * * * *"
You can learn how to create and test the Cron syntax here.