Git Product home page Git Product logo

fabric8io.funktion's Introduction

  Funktion

Funktion is an open source event driven lambda style programming model on top of Kubernetes.

A funktion is a regular function in any programming language bound to a trigger deployed into Kubernetes. Then Kubernetes takes care of the rest (scaling, high availability, load balancing, logging and metrics etc).

Funktion supports hundreds of different trigger endpoint URLs including most network protocols, transports, databases, messaging systems, social networks, cloud services and SaaS offerings.

In a sense funktion is a serverless approach to event driven microservices as you focus on just writing funktions and Kubernetes takes care of the rest. Its not that there's no servers; its more that you as the funktion developer don't have to worry about managing them.

Maven Central Apache 2

funktion logo

Using funktion

  • You write a simple function in any programming language like this.

  • Create a funktion.yml file and associate your function with an event trigger endpoint URL such as a HTTP URL or email address to listen on, a message queue name or database table etc.

  • Kick off the build (usually a Jenkins CI / CD pipeline and your funktion will be deployed to your kubernetes cluster!

  • Win! :)

Examples

Check out the following example projects:

Getting started

You can just fork one of the above examples and use command line tools to build and deploy it to a Kubernetes or OpenShift cluster.

However to make it easier to create, build, test, stage, approve, release, manage and iterate on your funktion code from inside your browser we recommend you use the Fabric8 Microservices Platform with its baked in Continuous Delivery based on Jenkins Pipelines together with integrated Developer Console, Management (centralised logging, metrics, alerts), ChatOps and Chaos Monkey.

When using the Fabric8 Microservices Platform you can create a new funktion in a few clicks from the Create Application button; then the platform takes care of building, testing, staging and approving your releases, rolling upgrades, management and monitoring; you just use your browser via the Developer Console to create, edit or test your code while funktion, Jenkins and Kubernetes take care of building, packaging, deploying, testing and releasing your project.

Using the Fabric8 Microservices Platform

First you will need to install the fabric8 microservices platform on a cluster of Kubernetes (1.2 or later) or OpenShift (3.2 or later).

Create and use your funktion

  • from inside your Team Dashboard page click Create Application button then you will be presented with a number of different kinds of microservice to create
  • select the Funktion icon and type in the name of your microservice and hit Next

select the funktion microservice and enter a name for your project

  • select the kind of funktion you wish to create (Java, Groovy, Kotlin, NodeJS etc) then hit Next
  • you will now be prompted to choose one of the default CD Pipelines to use. For your first funktion we recommend CanaryReleaseAndStage
  • selecting Copy pipeline to project is kinda handy if you want to edit your Jenkinsfile from your source code later on

select the CD Pipeline

  • click Next then your app should be built and deployed. Please be patient first time you build a funktion as its going to be downloading a few docker images to do the build and runtime. You're second build should be much faster!
  • once the build is complete you should see on the App Dashboard page the build pipeline run, the running pods for your funktion in each environment for your CD Pipeline and a link so you can easily navigate to the environment or ReplicaSet/ReplicationController/Pods in kubernetes
  • in the screenshot below you can see we're running version 1.0.1 of the app groovyfunktion which currently has 1 running pod (those are all clickable links to view the ReplicationController or pods)
  • for HTTP based funktions you can invoke the funktion via the open icon in the Staging environment (the icon to the right of the green 1 button next to groovyfunction-1: 1.0.1)

Funktion dashboard

Video demo

Coming soon!!! :)

How it works

When you implement your Funktion using a JVM based language like Java, Groovy, Kotlin or Scala then your function is packaged up into a Spring Boot application using Apache Camel to implement the trigger via the various endpoint URLs.

When using non-JVM based languages to implement your Funktion then the Spring Boot and Camel based trigger processor is embedded into your Kubernetes Pod via a sidecar container which then invokes your funktion; usually via a local REST call at least for now. Note that the use of sidecar is our current implementation strategy; going forward we'll support various options such as separating the trigger containers from the funktion containers for independent scaling for better resource utilisation.

We've focussed funktion on being some simple declarative metadata to describe triggers via URLs and a simple programming model which is the only thing funktion developers should focus on; leaving the implementation free to use different approaches for optimal resource usage.

The creation of the docker images and generation of the kubernetes manifests is all done by the fabric8-maven-plugin which can work with pure docker on Kubernetes or reuse OpenShift's binary source to image builds. Usually this is hidden from you if you are using the Continuous Delivery in the fabric8 microservices platform; but if you want to play with funktion purely from the command line, you'll need to install Java and install Apache Maven.

Underneath the covers a Kubernetes Deployment is automatically created for your Funktion (or on OpenShift a DeploymentConfig is used) which takes care of scaling your funktion and performing rolling updates as you edit your code.

Contributing to the project

We love contributions and you are very welcome to help.

License

This project is Apache Licensed

fabric8io.funktion's People

Contributors

fusesource-ci avatar jstrachan avatar davsclaus avatar rhuss avatar rawlingsj avatar nicolaferraro avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.