vcenter-connector is an OpenFaaS event-connector built to consume events from vCenter and to trigger functions.
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.
The following event types (incl. their subtypes) are supported and can be used to trigger functions:
- Alarm Event, e.g.
- Datastore Event, e.g.
- Host Event, e.g.
- Resource Pool Event, e.g.
- VM Event, e.g.
For further details and naming see the vSphere Web Services API documentation.
A function can be subscribed to multiple events using a comma-delimited syntax in its stack configuration:
[...] annotations: topic: "drs.vm.powered.on,vm.powered.off"
Note: Wildcards for event subscriptions, e.g. "
vm.powered.*", are not supported.
Credentials within Kubernetes
When using the connector in Kubernetes, you will need to create a secret for the connector in the
kubectl create secret generic vcenter-secrets \ -n openfaas \ --from-literal vcenter-username=user \ --from-literal vcenter-password=pass
At runtime these secrets will be mounted at
/var/openfaas/secrets/. See /yaml/kubernetes/connector-dep.yml for more.
Using credentials outside of Kubernetes
You can pass credentials via arguments (not recommended).
./vcenter-connector \ -vc-user="admin" \ -vc-pass="test1234" \
Or use a file and pass the name:
export secret_mount_path="/tmp/secrets/` ./vcenter-connector \ -vc-user="" \ -vc-pass="" \ -vc-user-secret-name=vcenter-username \ -vc-password-secret-name=vcenter-password
The default path is
/var/openfaas/secrets/ which can be overridden by setting the
secret_mount_path environment variable.
Examples / community
You can find a detailed example using vSphere tags for
Robert Guske of VMware write up a detailed blog post on how he automated the integration between several VMware products with OpenFaaS and this vcenter-connector.
Please propose changes in an Issue before submitting a PR and sign-off commits.
See the contribution guide for OpenFaaS for more.
This project is hosted and maintained by OpenFaaS Ltd
It makes use of the following components:
- govmomi project providing Golang bindings for vCenter by Doug MacEachern, VMware
- vcsim simulator tool by Doug MacEachern, VMware
The contact for OpenFaaS Ltd is Alex Ellis
The contact for VMware is Michael Gasch (VMware)