Event-driven interactions with vSphere using Functions as a Service


I am very happy to inform you that the below described idea has become a VMware Fling (completely OpenSource).

Official website of VMware Event Broker Appliance:

When was the last time that you were so much taken by a topic or better by a combination of several, that just by thinking about it your face is filled with enthusiasm?

For me, it’s only been a few days ago and it was in one of these afterwork-calls with my well appreciated colleague and friend Michael Gasch where we talked about things we were working on. I had just published my recent post on “Monitoring Container VMs with vRealize Operations Manager” were I described how I built a dashboard for & with vRealize Operations Manager to monitor the utilization and performance for two of the major objects from vSphere Integrated Containers, the Virtual Container Host (VCH) and the Container-VMs (cVM).

Michael told me that he had spent some time in digging deeper and deeper into the topic Functions as a Service

which was far away from being experienced by myself, but he got me right away from the very beginning of his telling. For those of you who want to know more about the topic but haven’t put your nose into it yet, like me before, you´ll find some links at the Resources section at the buttom.

I´m not going to explain what a Function/ FaaS is all about, instead of it Michael and I thought that this post should serve as an introduction of a project Michael is working on as well as to demonstrate how “just” two components are turning your vSphere environment into a Event-driven construct based on your annotations.

Before I´m going to start with the details and what should already be up and running, I`d like to quote the following description to explain what it means when it comes to the topic “Functions vs. Containers”.



Create a container which has all the required (Application) dependencies pre-installed, put your application code inside of it and run it everywhere the container runtime is installed.


Applications get split up into different functionalities (or services), which are in turn triggered by events. You upload your function code and attach an event source to it.

Source: Serverless (FaaS) vs. Containers - when to pick which?

Tagging vSphere objects by using a ƒ(x)

At the beginning I´ve mentioned that my last post was on the topic “Monitoring Container VMs with vRealize Operations Manager” and that I had to built a dashboard to do so. I´m using a widget in this dashboard called Object List to have the ability to select a specific Virtual Container Host, the Resource Pool not the Docker end-point VM(!), to display the utilization in terms of Limits & Reservations (CPU & Memory) of it.

While I was building this dashboard, one challange for me was, to find a way on which criteria these Resource-Pools will join a Dynamic Custom Group in vRealize Operations Manager (to appear automatically in the dashboard/ in the object list). Long story short, I decided to use vSphere Tags as a Membership-Criteria. But assigning a vSphere Tag is still a manually task (*1) and this is the point were Michaels function pytagfn or gotagfn, depending on the language you prefer, as well as the vCenter Connector comes into play.

A Feature-Request for using the vic-machine utility to assign a vSphere-Tag during the VCH deployment is already open on Github:

The following flowchart will give you a high-level overview what it´s all about and what Michael and I will demo you in the Video below.

Figure I: Flowchart vSphere Tag assignment
  1. vCenter-Connector is listening to the event-stream coming from the vCenter Server and talks to the OpenFaaS-Gateway to retrieve a list of functions which are interested in incoming events.

  2. pytag-fn will get invoked by a specific event (e.g. resource.pool.created).

  3. vSphere Tag assignment through the triggered function.

  4. vRealize Operations Manager is polling data from vCenter Server in certain intervals.

  5. Resource Pool is added to the Dynamic Custom Group and is available in the dashboard/ object-list.

The recording

What you need | Pre-reqs

All you need is OpenFaaS running in Kubernetes. As shown in the flowchart as well as having been mentioned in the recording, I´m running VMware´s Enterprise-grade Kubernetes solution VMware PKS in my #Homelab in order to make all necessary pieces available.

Another pretty cool alternative way to run OpenFaaS on k8s is KinD which is a new tool from the Kubernetes community named Kubernetes in Docker.

Figure II: kind logo

Alex Ellis has already written a nice blog-post on it: “Get started with OpenFaaS and KinD”. Check it out!

Install OpenFaaS on Kubernetes

Installing OpenFaaS on Kubernetes is quite easy by using the “OpenFaaS-on-Kubernetes” Edition faas-netes. Go through the documentation and you´ll have it installed in a couple of steps.

Having followed the instructions in the documentation, you will end up with the following components installed:

  1. Helm with the Helm client (helm) and the Helm server (Tiller - running in the namespace kube-system).

  2. OpenFaaS on Kubernetes

  • deployed into the namespace openfaas
  1. The faas-cli via e.g. brew or curl

  2. Github Repo vCenter Connector

As of writing this post:
The demo is based on a pending pull request (PR) in the vcenter-connector Github repository, which is currently under review. The PR, including all the details and files changed, can be found here:
  1. Github Repo pytag-fn or Github Repo gotag-fn

I hope you enjoyed reading and liked the recording.


Article Link
[@openfaaS] Deployment guide for Kubernetes
[@github/openfaas-incubator] Github repo vcenter-connector
[github/embano1] Github repo pytagfn
[github/embano1] Github repo gotagfn
[] Get started with OpenFaaS and KinD
[] Events, the DNA of Kubernetes
[] Getting started with VMware Pivotal Container Service (PKS) Part 1: Overview
[] PKS NSX-T Home Lab – Part 10: Install Ops Man and BOSH
[] VMware PKS 1.3 What’s New
[] Dispatch to support Knative and Joins Cloud-Native Apps BU
[] Getting Started with VMware Dispatch on Kubernetes
[] Serverless (FaaS) vs. Containers
[] Search query “Functions as a Service”
[] VMware PKS Landing Page
[] Pivotal PKS Landing Page