Creating your own OpenFaas Connector


Serverless is a restrictive model, you can only work within the framework provided and extending functionality is almost impossible, in most cases. OpenFaas differs in this respect as from an architecture standpoint, it is just a collection of containers talking with each other through REST. A connector can be viewed as a container running in the cluster alongside other OpenFaas components, and interacting with them.

Function Annotations and OpenFaas Gateway

Functions deployed on OpenFaas can have annotations, which are a list of key-value pairs to assign extra data to functions. You can set function annotations by specifying them in the yaml file or giving an --annotations flag to faas-cli. The functions can be queried through OpenFaas gateway's REST api: GET /system/functions. It returns an output something like this:

Connector SDK

OpenFaas has a connector sdk for fetching a list of functions and invoking functions with a set topic. A dead simple connector that invokes functions every 2 seconds:

Package and deploy

Now, lets get to packaging the connector in a container. The steps involved are:

docker stack deploy func -c ./docker-compose.yml kubectl create -f ./kubernetes --namespace openfaas
faas-cli deploy --image=functions/nodeinfo --name=trigger-func --annotation topic =faas-request

More examples and conclusion

OpenFaas connector pattern spawned from kafka-connector to add new functionality to existing OpenFaas deployment without changing OpenFaas source code. I dwelled into connectors so that I can build a timer trigger for OpenFaas since this functionality is not currently present. You can checkout cron connector repo and even build your own awesome connector.




save Your Data! —

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Exercise: Parametric tower — part 2

Configure Hadoop and start cluster services using Ansible Playbook

Set up a Hadoop Cluster using Ansible | LaptrinhX

Joining the Major League Hacking Team

gRPC and Protocol Buffers in Golang

Achieving Cloud Native Security and Compliance with Teleport

Success story and Case studies for Discovery Channel on AWS cloud

Building a CLI app with the Device Code grant and golang

Android Studio 3.0 25 October 2017

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


save Your Data! —

More from Medium

CS373 Spring 2022: Daniel Fernandez: Final Entry


I created an artificial intelligence-based cover letter generator

From 0 to 1, SGEM is coming