/vcenter-connector

Trigger OpenFaaS Functions from events in VMware vCenter

Primary LanguageGoMIT LicenseMIT

vcenter-connector

vcenter-connector is an OpenFaaS event connector built to consume events from vCenter.

Build Status

Overview

With this project your functions can subscribe to events generated by the changes (i.e. events) in your vCenter installation - for instance a VM being created, turned on or deleted. This allows you to extend vCenter's functionality by writing functions to execute each time an event is fired. An example may be tagging a VM with the date it was last turned on or applying a tag showing which user made a change to an object.

Status

This project uses the OpenFaaS Connector SDK.

The code is under active development and only suitable for early adopters. For the initial version the vCenter user credentials need to be stored in plain-text in your YAML files, but this will move to using OpenFaaS secrets in the next version.

Supported Events

The following event types (incl. their subtypes) are supported and can be used to trigger functions:

  • Alarm Event, e.g. AlarmCreatedEvent
  • Datastore Event, e.g. DatastoreDestroyedEvent
  • Host Event, e.g. HostDisconnectedEvent
  • Resource Pool Event, e.g. ResourcePoolCreatedEvent
  • VM Event, e.g. VmPoweredOnEvent

For further details and naming see the vSphere Web Services API documentation.

Example

You can find a detailed example using vSphere tags for VmPoweredOnEvent here. You might also want to check out Robert Guske's blog post on how he automated the integration between several VMware products with OpenFaaS and this vcenter-connector.

License

MIT

Acknowledgements

Thanks to VMware's Doug MacEachern for the awesome govmomi project providing Golang bindings for vCenter and the vcsim simulator tool.

Thanks to Karol Stępniewski for showing me a demo of events being consumed in OpenFaaS via vCenter over a year ago at KubeCon in Austin. Parts of his "event-driver" originally developed in the Dispatch project have been adapted for this OpenFaaS event-connector including a method to convert camel case event names into names separated by a dot. I wanted to include this for compatibility between the two systems.

Other acknowledgements: Michael Gasch (VMware) and Ivana Yocheva (VMware).