Source: OpenFaaS Blog

OpenFaaS Blog Integrate FaaS Capabilities into Your Platform with OpenFaaS

Learn how a Functions as a Service or (FaaS) capability can be integrated into your platform. With a FaaS capability, customers can provide their own code to execute, and your own staff can extend your product without going through release cycles. OpenFaaS provides a turnkey solution with modular components and REST APIs that are easy to integrate and adapt to your own needs. A quick overview of Functions as a Service Functions have become an industry standard for cloud computing, and are available on all major cloud providers. They are often used for background tasks, event-driven processing, and for extending products with custom code. Functions can be written by developers, or people with less traditional development roles alike, because they are often short, and focused on a single task, such as transforming an input into an output, storing data, or calling an API. The use-cases for functions are broad, these are some of the examples we’ve seen from customers over the years: Transforming data from one format to another such as eCommerce payloads Applying rules to security alerts on DNS, network traffic, HTTP requests, or logs, etc Encrypting or decrypting data for long-term storage Running a machine learning model to predict the next best action for a user Enhancing or enriching data with additional information from a third-party API Sending notifications or alerts based on a trigger Performing maintenance tasks on a scheduled basis Data-science and analytics tasks Invocations can be run directly by users, can be triggered by an event source such as AWS SNS/SQS/S3, Apache Kafka, MQTT, cron, or can be executed in the background, and scaled up or down based on demand. OpenFaaS runs on Kubernetes and makes use of native objects such as Deployments, Services, Secrets, Namespaces, and Ingress to provide a secure and scalable platform for running functions. The platform is language-agnostic, and functions can be written in any language that can be packaged into a container image. In this article In this article, we begin by looking at two types of users we generally hear from who want to integrate a FaaS capability, then we we’ll see three customer case-studies, showing how they have integrated OpenFaaS for Enterprises into their applications. Above: The customer dashboard for E2E Networks Limited, a publicly traded cloud provider based in India. Is this you? Let’s look at three potential use-cases or personas who may be thinking about functions. 1. You work in a small team valuing agility & control If you’re part of a small team and want to use functions, there are a few reasons you may be considering this option. You’d like: increased velocity to abstract away the painful details of Kubernetes such as Pod lifecycle and autoscaling a built-in way to scale background tasks to ship code to production faster more control vs a cloud option portability between environments The above reasons are why Kevin Lindsay, Principal Engineer at Surge chose OpenFaaS. Kevin said: When we first adopted OpenFaaS, it was primarily to handle ETL tasks, but it has since become integral to our entire product architecture. We’ve migrated older code into OpenFaaS and now develop everything new—whether it’s internal tools or static websites—as functions. This has significantly improved our development speed and scalability, freeing us from worrying about the intricacies of Kubernetes. The asynchronous queue-worker pattern has been particularly impactful, enabling reliable background job processing, with built-in retries and flexible scaling options like spot instances to keep our costs in check. For teams with this kind of use-case, where you want to use functions directly as part of the product, OpenFaaS Standard would be a good fit. The other two use-cases we’ll explore are where a team wants to offer a FaaS capability to its own users and/or staff. 2. You need to extend your product Your product needs to be extended without redeploying the whole thing, this should be dynamic and easy to achieve, within seconds of providing some custom code. Your staff, or your users, or both will provide code in a set number of languages, and you need to build, deploy, and manage it. This code may execute in response to events, a schedule, or a third-party API call. You’ve considered building your own solution, and may have explored options like the V8 JavaScript isolates, but found that you couldn’t support Python, and that the sandboxing was insufficient. Your development team already works on a product, and is quite capable of front-end and back-end development, so when given well documented APIs and occasional guidance, you believe that they can integrate them into the product within a relatively short period of time. The team at Cognite integrated OpenFaaS to create an offering for data-scientists at oil mining companies. Their users provide functions in Python or JavaScript which run simulations and fault prediction models using huge sets of data from the oil rigs. We discuss Waylay and Patchworks later in this article, both of whom also fit this profile. 3. Your business provides cloud computing If your business provides cloud computing, you may have a dashboard for your customers, and you’re looking to add a “Functions” tab to it. Your core offering may be built upon a hypervisor such as: VMware, OpenStack, Apache Cloud Stack, a self-built solution, or a repackaging of another cloud’s APIs. Your dashboard has a tab for “VMs”, “Block storage”, “VPCs, “Load Balancers”, “Object Storage”, “Databases”, and you even added a tab for “Kubernetes” some time ago. What’s missing from the above? Functions. You have customers who are used to seeing Functions on AWS, Google Cloud, and Azure, and they are wondering what you’re going to provide them with. Your competition may have added Functions to their platform already, and you’d like to catch up as quickly as possible. We discuss E2E Networks Limited later in the article that fits into this category. In either case You may not have the appetite to build your own solution from scratch. You know that when you use an Open Source project, that there’s no certain future for it, it’s likely severely overstretched and underfunded, if it’s even actively maintained anymore. You’d have to do a complex evaluation of every popular option and weigh up the risks and benefits. One option you may have considered is to build a proxy to an existing cloud functions service, but you find the pricing doesn’t scale, or the service is too opinionated, or doesn’t support the languages you need. What’s in the turnkey solution for FaaS? OpenFaaS for Enterprises is a turnkey solution that contains the APIs, documentation, language support, and building-blocks you need to integrate “FaaS” into your product or cloud offering. So what’s included? A Function Builder API Allows code to be submitted, built, and deployed seamlessly. This REST API accepts a Docker build context and publishes a container image to a remote registry. It can be run without root privileges, and can be used to build and deploy functions in a multi-tenant environment. The most popular way customers use this is to provide a UI with a code editor such as ACE, Cloud9, or Monaco, and to let customers provide code in a set number of languages. The OpenFaaS REST API APIs for managing and invoking functions, with built-in security features. The OpenFaaS REST API has endpoints to create and manage tenant namespaces, to deploy new functions, list and query existing ones, and to invoke them. The API has RBAC and IAM built-in, so you can define fine-grained permissions for users, teams, and customers. You can also create roles for your existing microservices that may integrate with the FaaS platform. Billing webhooks & chargeback Monetization is straightforward with billing hooks. Monetization and billing are not an afterthought here. You can provide a webhook URL and will receive batches of events in JSON format whenever a function is invoked for a tenant. The events include the namespace, function name, memory allocated, and the duration of the invocation. The documentation also has a sample Postgresql schema for storing this data. Identity Management and Single Sign-On (SSO) Multi-tenancy and role-based access control to maintain security and segregation of functions. The REST API, CLI and Dashboard are all multi-tenant segregating functions by namespace. IAM can be used to define roles with specific permissions for different resources and actions. Single Sign-On supports compliant OAuth2 and OpenID Connect providers, meaning the components can be exposed directly to users if you wish. Monitoring & metrics Prometheus metrics and Grafana dashboards for insights and performance monitoring. Detailed Prometheus metrics are available for tenant functions, and the Function Builder API. You can deploy the included Grafana dashboards to monitor the platform and can query this metrics using HTTP to provide customers with their own dashboards. Documentation & support Guidance, reference documentation, and weekly office hours. When you buy OpenFaaS for Enterprises, you get access to the engineering team on a weekly office hours call to talk about your integration, to ask questions and to get direction. You can email the team at any time with questions, and you’ll find comprehensive documentation on the website. There’s more available, but these are the core building blocks to take code from customers, to build it, deploy it, and to integrate the new endpoints into your product. What it looks like Let’s look at three different customer implementation, walking through their public documentation. Each customer calls “Functions” something slightly different

Read full article »
Est. Annual Revenue
$100K-5.0M
Est. Employees
1-25
Alex Ellis's photo - Founder of OpenFaaS

Founder

Alex Ellis

CEO Approval Rating

90/100