Introduction to On-Premises Serverless Function as a Service with OpenFaaS and Go

The Function as a Service (FaaS) paradigm allows developers to focus on code with a reduction in concern for infrastructure. As a result apps that can specifically be deployed as FaaS or utilize elements of FaaS can typically attain faster speed to market than alternative methods of representing and encapsulating callable functionality.

In this article aiming to outline OpenFaaS functionality in depth we will look at the basic concepts of FaaS and OpenFaaS and stand-up a first lab environment to perform some basic proof of concept of the OpenFaaS Serverless platform.

In later articles we will look at using OpenFaaS to invoke custom Go functions, the utilization of Kafka to trigger OpenFaaS functions and the utilization of templates to further our practices for development.

In yet further articles we will look in depth at the scaling of OpenFaaS and its requisite components and ecosystem.

What is FaaS?

FaaS can be considered a sub-concept of the serverless concept whereby serverless can be considered a mode in which:

  • The developer experience (devx) requires the development of small units of code and low to no need to orchestrate infrastructure directly.
  • Either functions or microservices are developed.
  • Scaling and parallelism can be afforded just-in-time and facilitated by the infrastructural software.
  • The developers code is portable between different FaaS infrastructures.

In this case the concentration on function engenders a reduced burden on software management for the developer, a focus on smaller units of code that are more business value focused, a tendency towards being event driven or driven by an endpoint such as REST/HTTP and arguably improved understanding due to these factors and that function interfaces are isomorphic.

Serverless offerings are typically either offerings that are SaaS or can be deployed on-premise and typically to a Kubernetes cluster. The current CNCF vogue is to follow the best practices of what has become known as Serverless 2.0.

What is Serverless 2.0?

Serverless 2.0 begs the question as to what is/was Serverless 1.0.

Early, now retrospectively termed, Serverless 1.0 FaaS offerings supported by cloud vendors (such as AWS Lambda), typically faced a number of problems; the most salient of which included limits to the Developer experience; so, lack of standardization between vendors, portability barriers, flexibility and so on. A good reference of these problems can be found in [1]

In order to help address some of these concerns CNCF defined a simple contract for Serverless 2.0. The contract is simple and promotes portability, it stipulates that:

  • OCI-compatible container image are used
  • An HTTP server on port 8080 is used
  • Configured by environment variables

What is OpenFaaS?

OpenFaas promotes the principle of run your code anywhere with the same unified experience. It supplies a function store and templating system that allows you to quickly stand up Serverless FaaS on-prem, on-cloud or even your development laptop. A connector-sdk is available for creating custom golang connectors.

Other solutions exist that are either installable on-prem or Cloud Native. Notable players include Google Cloud Functions and KNative.

Why Go?

Go has becoming associated with the moniker of being a cloud native programming language. It was originally designed by Google in 2007 to tackle idiomatic problems of developing and maintaining distributed software projects and evolving them over time. Arguably other languages such as Rust engender similar qualities; however, I selected go for this effort as I am currently using it extensively for k8s private cloud projects.