Skip to content

openfaas/cron-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b07e85a · Jan 21, 2025

History

70 Commits
Jan 21, 2025
Jan 21, 2025
Jul 14, 2021
Dec 2, 2019
Jul 14, 2021
Dec 4, 2019
Jan 21, 2025
Feb 9, 2021
Aug 13, 2022
Mar 25, 2022
Aug 13, 2022
Jan 21, 2025
Jan 21, 2025
Jan 21, 2025
Jul 14, 2021

Repository files navigation

Invoke your functions on a cron schedule

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.

How to Use

First, deploy OpenFaaS with faasd or Kubernetes

Deploy the connector for Kubernetes

For Kubernetes, see: Scheduling function runs

Deploy the connector for faasd

For faasd, see Serverless For Everyone Else.

Trigger a function from Cron

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:

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.